Memory Working Set of Windows reports higher number

Use this forum for questions on how to use .NET Memory Profiler and how to analyse memory usage.
Post Reply
llama
Posts: 1
Joined: Tue Jul 10, 2012 1:44 pm

Memory Working Set of Windows reports higher number

Post by llama » Tue Jul 10, 2012 1:49 pm

Hi all,

I am very new to .NET Memory Profiler, and my CRL knowledge is kinda basic. Therefore, there is a weird situation that I just can't explain.

Basically, I suspect my program to have memory leaks. At startup, Windows Task Manager reports its Working Set (Memory) at around 200MB. After a night of running, the Working Set (Memory) spiked to 600 MB. Meanwhile, I took 2 snapshots of the program at those 2 points using .NET Memory Profiler, and the comparison told me that after overnight running, the program has total live bytes of 130 million (~130MB), and has only increased since startup at around 350 KB.

Can anyone help me understand what those numbers mean?

Thank you!

Andreas Suurkuusk
Posts: 1029
Joined: Wed Mar 02, 2005 7:53 pm

Re: Memory Working Set of Windows reports higher number

Post by Andreas Suurkuusk » Tue Jul 10, 2012 10:00 pm

When you collect a snapshot, the profiler will perform a garbage collection in the profiled process and wait for pending finalizers. This is done to make sure that only real reachable instances are presented in the snapshot. So the number of bytes you see presented for a snapshot, is the number of bytes consumed by live instances on the managed heap. The working set includes the total memory allocated for the managed heaps (including unreachable instances and room for additional allocations). Additionally, it includes native memory not managed by the .NET runtime.

You can use the profiler to get additional information about the total memory usage of your application.
  • The real-time graph includes a Total bytes plot, which includes all instance on the heap, even unreachable instances.
  • You can collect a gen #0 snapshot (using the "Profiler->Collect gen #0 snapshot" command). This will avoid performing a full GC, and you will get information about unreachable instances on the heap as well.
  • You can track information about the peak managed memory usage using the commands "Profiler->Track peak snapshot" and "Profiler->Collect peak snapshot"
  • The native memory view will give you an overview of the total native memory used by the profiled process. The "Private" node in the "Physical memory" tree should correspond to the private working set presented by the task manager.
  • You can also get much more detailed information about the native memory usage by enabling the unmanaged resources tracker. The information includes allocation call stacks of all native memory allocations.
Best regards,

Andreas Suurkuusk
SciTech Software AB

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 28 guests