Board index » delphi » Memory usage problems

Memory usage problems


2003-11-30 11:12:18 PM
delphi224
Hi all
I have the following problem: If I create an empty project
with one form (Delphi 6 Prof, Windows XP Prof) and run it,
task manager shows a mem usage of 2.5 megs.
When I click the minimize icon, mem usage drops to 0.5 megs.
Click the restore icon and mem usage is 0.95. Then it will
stay between these limits (0.5 minimized, 0.95 restored).
Questions:
1) why that first mem usage (2.5 megs)?
2) how can I simulate a minimize to get the same effect as
clicking the minimize icon?
I tried WindowsState = wsMinimized but the effect is not the
same as clicking with the mouse: mem usage is around 0.9 when
minimized and 1.75 when restored.
Also, if I do WindowsState := wsMinimized in OnShow event, the
window will minimize to caption bar in the left bottom corner of
the desktop. Why is this?
 
 

Re:Memory usage problems

XXXX@XXXXX.COM (Cargo) writes:
Quote
I have the following problem:
It's not a problem. it is normal behavior for Windows.
~ JD
 

Re:Memory usage problems

XXXX@XXXXX.COM (Cargo) writes:
Quote
I have the following problem: If I create an empty project
with one form (Delphi 6 Prof, Windows XP Prof) and run it,
task manager shows a mem usage of 2.5 megs.
When I click the minimize icon, mem usage drops to 0.5 megs.
Click the restore icon and mem usage is 0.95. Then it will
stay between these limits (0.5 minimized, 0.95 restored).
Questions:
1) why that first mem usage (2.5 megs)?
2) how can I simulate a minimize to get the same effect as
clicking the minimize icon?
I tried WindowsState = wsMinimized but the effect is not the
same as clicking with the mouse: mem usage is around 0.9 when
minimized and 1.75 when restored.
First, Task Manager is about as reliable for memory statistics as
banana peels are for non-slip stair treads<g>.
Second, your actual memory commitment varies wildly depending on what
else is running at any given time. Windows tries very hard to keep all
physical memory actually in use, even when there's little chance it
will be used.
In general, trying to second guess Windows' memory management is
pretty much going to be an exercise in frustration.
Quote
Also, if I do WindowsState := wsMinimized in OnShow event, the
window will minimize to caption bar in the left bottom corner of
the desktop. Why is this?
Because there's an additional window used internally by your
application. If you want to minimize completely, write:
Application.Minimize;
Good luck.
Kurt
 

Re:Memory usage problems

XXXX@XXXXX.COM (Kurt Barthelmess (TeamB)) writes:
Quote
First, Task Manager is about as reliable for memory statistics as
banana peels are for non-slip stair treads<g>.
I know that, but I have users who don't believe me but believe
Task Manager :( I have to show them the minimum amount of mem
usage in Task Manager.
Quote
Because there's an additional window used internally by your
application. If you want to minimize completely, write:

Application.Minimize;
Where should I put this call? I tried in OnCreate, OnShow and in project file(dpr).
The result is that the window is still there but the minimize icon
doesn't work anymore.
The only place where this works is in some button click event (or timer event) .
But I cannot use that because my application runs in system tray from the beginning
(and actually it has no minimize icon). If I put it in the timer event, my application
appears in the taskbar.
Also, this is a per window behaviour: I have do it for every window
in my application.I cannot minimize the application for every window I use.
So I need to simulate the minimize click for every window.
 

Re:Memory usage problems

XXXX@XXXXX.COM (Cargo) writes:
Quote
I know that, but I have users who don't believe me but believe
Task Manager :( I have to show them the minimum amount of mem
usage in Task Manager.
Well, they probably won't believe me either then<g>. Maybe you could
refer them to this article. As the author is a MS MVP, maybe that will
carry more weight with them.
aumha.org/win5/a/xpvm.htm
Quote
Where should I put this call? I tried in OnCreate, OnShow and in project file(dpr).
The result is that the window is still there but the minimize icon
doesn't work anymore.
I put it in the OnShow event handler, which is where you were setting
WindowState. But I see (now) it does have some undesirable side
effects - clicking on the taskbar restores the window, but not the
application.
Quote
But I cannot use that because my application runs in system tray from the beginning
(and actually it has no minimize icon).
Well that will mess things up. Then Windows won't even let you
minimize it normally.
Quote
Also, this is a per window behaviour: I have do it for every window
in my application.I cannot minimize the application for every window I use.
So I need to simulate the minimize click for every window.
I don't think you can do that unless the window has the biMinimize
option in the BorderIcons property. iac this is all (if you will
pardon the expression) window dressing. Once your application needs
that memory back, it will come back. When Windows wants that memory
for something else, it will be tossed out. Perhaps your client would
reconsider their position after reading the article mentioned above.
Good luck.
Kurt
 

Re:Memory usage problems

OK, thank you