Hi Winston, Other Gurus... Help on Memory Usage

Brijesh81

Freshman
Joined
Jul 2, 2003
Messages
25
Location
New Delhi
Hi Winston,

I read your comments in response to one of the posts.

Following was the question..

In a VB.Net application, Main form has a ListView, Listbox, statusbar, main menu and a 100k jpg.
The load event populates the listbox and listview controls with 2-3 items each from an access db.

The following is the memory at variouse stages:

After Load: 21 megs
Move form around screen: 22 megs
Minize form:600k
Maximize form: 4 megs
Move form around screen: 4.1 megs
Minimize form:600k
Maximize form: 4 megs
etc...

The Virtual Memory remains a constant 10.5 megs at all times.


Following was your response..

yes this is the basic theory


the more ram in the system in which its not being consumed

the more ram the application itself reserves


weird but it's a fact


you would notice if you ran that 22 meg app on a 64 megs of ram PC, it would probably use only 200k primarily because there isnt enough ram

there is a way to get around this

which is to use the


SetProcessWorkingSize function


which can show the "Real" memoru usage


my app used around 34 megs


but after calling this function on the form activate and deactivate events



it refreshes it to the real memory size which is 1 .2 megs



basically the task manager itself IMO is just decieving.


I read your comments. Have few doubts...Pls. Help

I believe that although the application doesn't need that much of RAM but it reserves for itself because RAM is available. This also means that if I start another application, the 2nd appln would also need memory and then 1st one would release the memory to be used by the second one. This memory release occurs automatically and is managed by the operating system.

Now why would I ever need to use trhe function SetProcessWorkingSize as explained by you in your response.
I feel that the only thing that I would achieve by using this function is that I would come to know the real memory requirement of the application. Because even if I don't use this function, my application would consume lot more memory than it needs but would quickly release once another application requires memory.

Please help. Thanks a lot in advance.
 
Back
Top