Solved

not enough memory

Posted on 1998-12-10
6
182 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 3

Expert Comment

by:williams2
ID: 1350390
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
ID: 1350391
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
ID: 1350392
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 8

Expert Comment

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

Accepted Solution

by:
Madshi earned 50 total points
ID: 1350394
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
ID: 1350395
thanks mdshi,

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

have a sunny day !
titz
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

728 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