Groups | Blog | Home
all groups > dotnet performance > january 2006 >

dotnet performance : Here's an oddity of memory usage


Dave
1/25/2006 10:00:03 AM
I've been experimenting with the memory footprint of a windows app and I've
come across some odd behaviour, which I'd appreciate some comments on from
someone who knows about these things.
Starting with a basic form app as generated by VS, with a single button -
nothing in the button click handler yet. This runs at about 8Mb memory, as
measured by task manager.
When minimised by the user this drops dramatically to 1M or under.
Putting WindowState=FormWindowState.Minimized; in the button handler has
pretty much the same effect, down to 1M or less when the button is pressed.
Putting Hide() in the button handler has no effect on the footprint at all.
Moving the WindowState=FormWindowState.Minimized; from the button handler to
the Form.Load event reduces the memory, but only to about 4M.
Moving the WindowState=FormWindowState.Minimized; to the constructor has no
effect on the footprint at all.
This behaviour is very puzzling. I am writing an invisible application ie.
one which, under most circumstances, has no UI at all (there are reasons why
it shouldn't be a service, before you ask<g>). I am trying to get the
resource usage as low as possible for this. Any comments/suggestions would be
welcome.
--
Dave
1/25/2006 12:25:02 PM
Would System Internals' Process Explorer be suitable?
--
Dave


[quoted text, click to view]
Alvin Bruney - ASP.NET MVP
1/25/2006 3:13:40 PM
As pointed out several times before, the task manager is not a realible way
to measure memory, use a counter or specialized tool.

--
Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The Microsoft Office Web Components Black Book with .NET
Now Available @ www.lulu.com/owc
Forth-coming VSTO.NET - Wrox/Wiley 2006
-------------------------------------------------------



[quoted text, click to view]

Harald Ums
1/25/2006 10:05:52 PM
It's called workingset trimming - every windows process does this not just
net processes: just minimize internet explorer and watch the counters
[quoted text, click to view]

john conwell
1/30/2006 1:41:28 PM
To be a bit more specific, when a window is minimized almost all of its
physical memory is paged down to the page file. so its virtual memory is
still the same, but the amount of RAM its taking up is much less. but as
soon as you bring the window back to normal or maximized, and start using it
the data will have to get pulled from the page file and swapped into RAM.

[quoted text, click to view]
AddThis Social Bookmark Button