Show kernal and .net resources/memory during debugging

Use this forum for questions on how to use .NET Memory Profiler and how to analyse memory usage.
Post Reply
Tobias
Posts: 1
Joined: Fri May 23, 2008 2:30 pm

Show kernal and .net resources/memory during debugging

Post by Tobias » Fri May 23, 2008 2:38 pm

I want to debug a .net application in visual studio 2008 and look for memory usage. I want to see consumption of both kernal and .net resources/memory between two breakpoints. Is there any way to do that?

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

Post by Andreas Suurkuusk » Sun May 25, 2008 9:19 pm

If you are debugging and profiling the same process, it is not possible to collect a heap snapshot while the debugger has stopped on a breakpoint. When collecting a snapshot the profiled process must respond to requests from the profiler, but if the process is stopped at a breakpoint all threads are suspended and the snapshot cannot be finished.

In the next version of .NET Memory Profiler we will make it possible to collect snapshots while debugging within Visual Studio. In the meantime, there is a workaround (a bit inconvenient though).
  1. Start profiling the application you want to investigate.
  2. Attach the Visual Studio debugger to the application. NOTE! For this procedure to work you must not attach the native debugger.
  3. When the debugger has stopped on a breakpoint, perform the following steps:
    1. In the "Threads" window, select all threads.
    2. Right-click on the threads and select "Freeze".
    3. Continue execution (F5)
    4. Collect a snapshot in the profiler.
    5. Break into the profiled process again by using Debug->Break All (Ctrl-Alt-Break).
    6. Select all threads again, right-click and select "Thaw".
  4. Now you have a snapshot at the location of the breakpoint that you just hit.
If you perform the steps above for two breakpoints, you will be able to analyse memory and resource usage between the snapshots.
Best regards,

Andreas Suurkuusk
SciTech Software AB

Post Reply

Who is online

Users browsing this forum: No registered users and 25 guests