Thursday, March 15, 2007

Looking for an application's memory usage

A crude but simple way of detecting memory leaks is start running the application, looking at the memory it consumes in the task manager, leaving the application to run for a while, and comparing the memory consumption to the earlier one.
And a common mistake is looking at the default "Mem usage" column for the data.
This column doesn't show you the actual memory reserved for the application, but the memory currently assigned to it by the operating system. You may have also noticed it tends to shrink when you minimize the application.
Instead you should enable the display of the "VM Size" column (using the "view" menu) and use the data displayed in it.


Sean Chambers said...

This isn't a sure fire way to accurately watch the memory footprint of a running application.

A much better way would be to fire up Performance Counter and then you can view memory usage of processes as well as the CLR in peticular. In addition you can setup many different views of memory statistics.

I haven't tried using ProcessExplorer, but I would imagine that you can drill down into the memory usage alot more using ProcessExplorer as well.

Adi said...

Of course there are better ways to monitor memory usage, but sometimes people still use this "poor man's counter", so it's important to know how to use it.