?
Solved

not enough memory

Posted on 1998-12-10
6
Medium Priority
?
184 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
Industry Leaders: 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 200 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

Industry Leaders: 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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses
Course of the Month13 days, 23 hours left to enroll

800 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