#666 – Looking at .NET Memory Usage Using Performance Counters

As you create new objects in .NET, the garbage collector allocates memory for the objects on the heap.  As memory is allocated, the process consumes some of its available virtual memory.  (In practice, a 32-bit process can allocate at most around 1.5GB of its 2GB maximum).

You can keep track of (roughly) how much memory on the managed heap that your application has allocated by using performance counters.

To track memory usage:

  • Start Performance Monitor


  • Start your application
  • Click the “+” icon to add a counter

  • Expand the .NET CLR Memory section

  • Select the # Total Reserved Bytes counter and select your application

  • Click the Add button and then click OK

You’ll now see a graph indicating total number of bytes of memory that your application has reserved.  The Last field will show you the most recent value.