Solved

Amount of used resources.

Posted on 1998-12-21
2
138 Views
Last Modified: 2010-04-04
Hi there,

Does anybodyknow any technique (or maybe solution or something) on how to reduce amount of resources (System/GDI) used by application or component?  
Once again, I do not leak resources, everything being freed nicely when app is closed but amount of resources being used wkile app's working is quite big (and when running on Windows95/98 is big dangerously). Thanks.

p.s. I dont have much windowed controls created. It is rather bitmaps (GDI resources).
0
Comment
Question by:_art_
2 Comments
 
LVL 12

Accepted Solution

by:
rwilson032697 earned 100 total points
ID: 1352351
_art_,

There are a couple of very effective things you can do:

1. Make sure you don't autocreate all your forms in the DPR (this is a real killer). Instead create the form where you need it (ie: just shift that line of code that creates the form from the DPR to the appropriate place in the code) and Release them as soon as you have done with them.

2. If after doing 1 above you are still having problems because of the bitmaps then you may need to look at some sort of caching strategy (delphi uses a number of caches to preserve GDI system resources - such as fonts and brushes) or a strategy that involves grabbing at least some of the bitmaps off disk only at the time you need them.

Cheers,

Raymond.
0
 
LVL 20

Expert Comment

by:Madshi
ID: 1352352
Raymond is right with the autocreation of forms.

About bitmaps: You should use TImageList (or something like that) instead of using single Bitmaps. Because each and every TBitmap (respectively TImage) consumes one handle, while all the images in one imageList comsume all together only one handle. And since the kind of resources you're talking about is in reality the percent of free handles, that's very important.

Regards, Madshi.
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

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…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

830 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