Tuesday 11 March 2008

.NET Memory Usage

Had an issue with a user complaining that Excel uses too much memory in task manager, so I investigated what the usage really is.

The first point to note is that Task Manager does not accurately report the memory used by an application. It shows the Working Set - that is memory that has been "reserved" by Windows just in case. If another application needs the memory then it is re-allocated. As such we really need to measure memory usage using Performance Manager.

The main counters to add are from the Process object. Make sure you select your .NET application, and add the counters Private Bytes and Working Set. Private Bytes gives the true (ish) figure - however bear in mind that this may be swapped to disk so will not necessarily have an impact on your system.

The article that explains this further can be found here.

No comments: