?
Solved

Memory Issues

Posted on 2002-07-17
6
Medium Priority
?
229 Views
Last Modified: 2010-04-04
Hi People,

I've got an annoying problem.  I have an application.  When it first opens, it uses 5,316K of memory.  If I minimize it, the app uses a more respectable 752K.  If I restore it again, it uses 1,402K (which is still fine).

I minimize the application to the system tray at start up (it's an internet usage meter), but it still opens using 5,316K of memory.  This is WAY too much for such a small exe.

Can anyone tell me how I can reduce the memory foot print of this application?

Cheers!

Stu
0
Comment
Question by:SJohnson
[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
  • 3
  • 3
6 Comments
 
LVL 20

Accepted Solution

by:
Madshi earned 1600 total points
ID: 7159248
Call SetProcessWorkingSetSize(GetCurrentProcess, dword(-1), dword(-1)) during initialization of your application. This has the same effect as minimizing/restoring it.

Regards, Madshi.
0
 
LVL 1

Author Comment

by:SJohnson
ID: 7159347
Hi Madshi,

I had to call it repeatedly before it would work.  Is that OK?

  SetProcessWorkingSetSize(GetCurrentProcess, dword(-1), dword(-1));
  Application.Initialize;
  SetProcessWorkingSetSize(GetCurrentProcess, dword(-1), dword(-1));
  SetProcessWorkingSetSize(GetCurrentProcess, dword(-1), dword(-1));
  Application.CreateForm(TMainForm, MainForm);
  SetProcessWorkingSetSize(GetCurrentProcess, dword(-1), dword(-1));
  Application.Run;

Cheers,

Stu
0
 
LVL 20

Expert Comment

by:Madshi
ID: 7159367
I see no reason for that. What if you simply keep the last one (the one before Application.Run) and delete the others? That should basically have the same effect, I think.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 1

Author Comment

by:SJohnson
ID: 7159397
Nope, still the same.  I'll leave it as is.  That's fine Madshi.  Fantastic actually!

Stu
0
 
LVL 20

Expert Comment

by:Madshi
ID: 7159477
Don't understand it, but doesn't matter...   :-)
0
 
LVL 1

Author Comment

by:SJohnson
ID: 7159488
No, it's strange.  I'll take a proper look at it tomorrow when I get a little more time.  At this point in time, it's working well and that's what counts <G>

Thanks again, Mr Brain!

Stu
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying 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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month7 days, 23 hours left to enroll

765 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