Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Reducing System Resources

Posted on 1999-01-08
5
Medium Priority
?
225 Views
Last Modified: 2010-04-06
My program uses a lot of resources, I using Delphi 3.

I want someone to provide to me, efficient tips for reducing the resources that a Delphi application needs (most, the better)
0
Comment
Question by:HarisIV
  • 3
5 Comments
 

Expert Comment

by:ptiemann2
ID: 1355310
A good way to cut down on the amount of memory used,
assuming your program does not use OLE, is to free a DLL:

 FreeLibrary(GetModuleHandle('OleAut32'));

This unloads OleAut32.dll and OLE32.dll, and can make your
program use about one megabyte less memory of RAM.

taken from http://www.preview.org/q/q2012.shtml

0
 
LVL 20

Expert Comment

by:Madshi
ID: 1355311
Which resources do you mean?
Just general memory consumation or this 90% system, GDI and user resources already known from win3.11?

If you mean the system, GDI and user resources, you should listen to this:
Each and every TBitmap/TIcon/TImage you use, consumes one handle. And Windows (win95, too) can only handle a restricted amount of handles. The %-resources show you how many percent of the handles are not used yet.
So if this is your problem, you should first of all look at TImageList. This is a bitmap/icon container, in which you can put all images/icons that have the same size and color depth. And every TImageList consumes only one handle. So this is probably the most important thing you can do.
Then, if your application has a lot of forms, you should think about creating them only if needed. Normally Delphi created all forms when the program starts. They are hidden, but consume a lot of handles. If you don't let Delphi create them at the program start, but if you create them yourself only if you need them (and free them afterwards), you'll save a lot of resources, too. If you don't know how to do this, ask me...

Does this help?

Regards, Madshi.
0
 

Accepted Solution

by:
mjustin earned 250 total points
ID: 1355312

- create forms at runtime if possible and free them after use (this also will increase startup speed!)

- if your users run more than one Delphi application, use the Package technology (<100 KB exe Size are possible!)
0
 
LVL 20

Expert Comment

by:Madshi
ID: 1355313
Hey, mjustin, do you really think, your answer is better than my comment???????
HarisIV, please decide, if you like my comment more than mjustin's answer, then please reject his answer...
0
 
LVL 20

Expert Comment

by:Madshi
ID: 1355314
G#+*'&%$#@'##   I hate it...  :-(((
0

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

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Integration Management Part 2
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

783 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