not enough memory

Posted on 1998-12-10
Last Modified: 2010-04-04

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 ??

Question by:titz

Expert Comment

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)

LVL 20

Expert Comment

ID: 1350391

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 "". It does nothing but show you the current amount of free handles in percent.

Regards, Madshi.

Author Comment

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 ?


Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.


Expert Comment

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

Accepted Solution

Madshi earned 50 total points
ID: 1350394

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...

Author Comment

ID: 1350395
thanks mdshi,

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

have a sunny day !

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Help on project with Soap 10 57
Delphi application Soap connection 5 121
delphi parse string to params 3 136
Is anyone willing to have a look through this code and help debug? 25 84
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

829 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