none
Task Manager Virtual Memory Size unreliable ?

    Question

  • Hi,

    I have recently been debugging a memory leak in a .Net windows service that uses COM Interop.

     

    Initially, I was using Task Manager (on Windows XP) to monitor the process memory. I selected both the 'Memory Usage' and 'Virtual Memory Size' columns, but this did not show a significant memory problem.

     

    After finding a useful MSDN Magazine article on debugging memory issues, I started using the system Performance tool, monitoring various counters including 'Virtual Bytes', expecting this to match the values reported by Task Manager.

     

    However, I found that the 'Virtual Memory Size' reported by Task Manager was vastly lower than the 'Virtual Bytes' reported by Performance tool.

     

    I also found that the 'Virtual Bytes' reported by Spy++ was consistent with the Peformance tool.

     

    As the process was generating OutOfMemory exceptions, I believe that the 'Virtual Bytes' figure from Performance tool and Spy++ was more likely to be correct, as this was showing that virtual memory was exhausted.

     

    The inconsistency does not seem to arise for native/COM applications, only the CLR process.

     

    Is this a problem with Task Manager or am I missing something here ?
    Wednesday, April 25, 2007 10:02 PM

Answers

  • With Task Manager you see private bytes which match exactly with the Spy++ display. The naming is misleading but .... Well it is that way.

    Yours,
       Alois Kraus

    Thursday, April 26, 2007 12:12 AM
  • There naming of task manager is misleading with other tools, but the value that it displayed is right.

            Thanks!Smile

    Thursday, April 26, 2007 2:00 PM
  • If you want to track OOM, you can reference the "VM Size" in Task Manager. The name for it is misleading and it is actually the "Private Bytes" counter in PerfMon, as is mentioned by Alois.

     

    "Private Bytes" is a good indicator for most memory issues. However, under some conditions, you may encounter VM leak. In these cases, virtual memory is reserved only but never committed or freed. You may observe OOM while "Private Bytes" is still not high. In this case, you also need to reference the "Virtual Bytes" counter.

     

    To conclude, you can mainly focus on Private Bytes usage of a process and also check Virtual Bytes for potential VM leak.

    Monday, April 30, 2007 2:28 AM

All replies

  • With Task Manager you see private bytes which match exactly with the Spy++ display. The naming is misleading but .... Well it is that way.

    Yours,
       Alois Kraus

    Thursday, April 26, 2007 12:12 AM
  • There naming of task manager is misleading with other tools, but the value that it displayed is right.

            Thanks!Smile

    Thursday, April 26, 2007 2:00 PM
  • If you want to track OOM, you can reference the "VM Size" in Task Manager. The name for it is misleading and it is actually the "Private Bytes" counter in PerfMon, as is mentioned by Alois.

     

    "Private Bytes" is a good indicator for most memory issues. However, under some conditions, you may encounter VM leak. In these cases, virtual memory is reserved only but never committed or freed. You may observe OOM while "Private Bytes" is still not high. In this case, you also need to reference the "Virtual Bytes" counter.

     

    To conclude, you can mainly focus on Private Bytes usage of a process and also check Virtual Bytes for potential VM leak.

    Monday, April 30, 2007 2:28 AM