Solved

not enough memory

Posted on 1998-12-10
6
175 Views
Last Modified: 2010-04-04
hallo,

i have a program under D3 and WIN98 which loads
a lot of small bitmaps into memory. And some times i get the
system messages:"Not enough memory space free" and
my program breaks down.
i think there is no function like memavail to find out
how many bytes of memory are free, - or ??
The TMEMORYSTATUS (with globalmemorystatus-function) gives not back the correct value that i need.
What can i do, to stop my loading of bitmaps before
the message arrives ?

any idea ??

thanks
titz
0
Comment
Question by:titz
6 Comments
 
LVL 3

Expert Comment

by:williams2
Comment Utility
You should use a MemoryStream to keep track of your bitmaps. In this way the system will handle virtual memory automatically. (That's indeed what Borland claims)

Regards,
Williams
0
 
LVL 20

Expert Comment

by:Madshi
Comment Utility
titz,

if it really is a memory problem, then there's surely a bug in your sources. Normally you shouldn't get such error messages in a bug-free program.
The other possibility is, that the problem is not the memory, but the gdi/handle resources. If you're loading a lot of bitmaps in TBitmap, each and every bitmap will have it's own handle. The solution for this problem would be to use an TImageList instead of single bitmaps.
To check whether you have a gdi/handle resources problem, you can download my freeware utility program "showRes.exe" from my homepage "http://beam.to/madshi". It does nothing but show you the current amount of free handles in percent.

Regards, Madshi.
0
 
LVL 1

Author Comment

by:titz
Comment Utility
Hallo Madshi,

it seems that you are right: with your tool i saw that the GDI- and system-Resources went down to 0%.
You will have the points. But tell me: what API-Function uses your tool ?

thanks
titz

0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 8

Expert Comment

by:ZifNab
Comment Utility
can't you put your coding in try except end?
0
 
LVL 20

Accepted Solution

by:
Madshi earned 50 total points
Comment Utility
titz,

hmmm. It's quite complicated. I'm using thunking mechanism to call the 16bit API "GetFreeSystemResources" from the 16bit dll "user.exe". I really don't know why Microsoft didn't implement a 32bit version...   :-(

Regards... Madshi.

P.S: Everything clear with the TImageList?

Hi Zif, putting this all into a try..except would not really help. The real problem is that titz consumes too many handles...
0
 
LVL 1

Author Comment

by:titz
Comment Utility
thanks mdshi,

i often thought the same: why is this function not implemented in 32bit ?

have a sunny day !
titz
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now