bnz
asked on
Memory usage
Hi
Can anybody explain this.
I have a crappy delphi app. which uses around 12 MB.
When I minimize it, it drops to use about one MB, that I understand fine. But when I maximize it again it only uses 3 MB. What has happend ? is there a 9MB memory leak which Windows have cleaned up for me ?
Can anybody explain this.
I have a crappy delphi app. which uses around 12 MB.
When I minimize it, it drops to use about one MB, that I understand fine. But when I maximize it again it only uses 3 MB. What has happend ? is there a 9MB memory leak which Windows have cleaned up for me ?
Hi,
What's the memory usage immediately after starting that app?
Possible situation: Your app creates objects and allocates memory for them. After some time the app frees some objects correctly but Windows memory manager doesn't deallocate freed memory at that time. Minimizing/restoring forces that process.
Regards, Geo
What's the memory usage immediately after starting that app?
Possible situation: Your app creates objects and allocates memory for them. After some time the app frees some objects correctly but Windows memory manager doesn't deallocate freed memory at that time. Minimizing/restoring forces that process.
Regards, Geo
ASKER
Is there anything I can do to trim the memory usage
I tried to call
SetProcessWorkingSetSize( HInstance, $FFFFFFFF, $FFFFFFFF );
Read about it a delphi usergroup, but it didn't do the trick
I tried to call
SetProcessWorkingSetSize( HInstance, $FFFFFFFF, $FFFFFFFF );
Read about it a delphi usergroup, but it didn't do the trick
does VirtualAlloc() offer any possibilities?
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/memory/memman_3elf.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/memory/memman_3elf.asp
>> SetProcessWorkingSetSize( HInstance, $FFFFFFFF, $FFFFFFFF );
Uah!!! Terrible!!! You've read THAT on a Delphi usergroup?
It has to look like this:
SetProcessWorkingSetSize(G etCurrentP rocess, $FFFFFFFF, $FFFFFFFF );
HInstance is not a process handle, it is the module handle of the executable module, which is a *totally* different thing...
Regards, Madshi.
Uah!!! Terrible!!! You've read THAT on a Delphi usergroup?
It has to look like this:
SetProcessWorkingSetSize(G
HInstance is not a process handle, it is the module handle of the executable module, which is a *totally* different thing...
Regards, Madshi.
ASKER
I tried another thing. I created a new application with a button, it uses 1.7MB I call SetProcessWorkingSetSize (the correct way) and it drops to around 0.7MB and stays there no matter what I do. Why do Delphi reserve 1.7MB when 0.7MB seems to be enough.
Madshi:
hehe ehmm not quite, I read about SetProcessWorkingSetSize and filled hInstance in ...my self :)
Madshi:
hehe ehmm not quite, I read about SetProcessWorkingSetSize and filled hInstance in ...my self :)
Don't know what Delphi does there and why. Does SetProcessWorkingSetSize solve the problem with your original application, too?
ASKER
Yes it seems so
Fine! Please don't ask me to explain it - I can't... :-/
ASKER
hehe, so your knowledge isn't inexhaustible after all ;)
I almost thought so
I almost thought so
:-)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Regards
//raidos