Solved

Amount of used resources.

Posted on 1998-12-21
2
135 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
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…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

910 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

24 Experts available now in Live!

Get 1:1 Help Now