Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Memory Issues

Posted on 2002-07-17
6
Medium Priority
?
237 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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

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.

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…
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…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses

610 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