Native Memory Diagnostics in CTP 5

Adam Welch (MSFT)

The Visual Studio Memory Usage tool is now selected by default in VS2015 CTP 5.  When you first debug a native app in CTP 5, the Diagnostic Tools window will launch and show both the Memory Usage and CPU Usage tools since they are both checked by default.  For more information on the Diagnostic Tools window and other tools, please consult this blog post by Dan Taylor.

Image 6355 1

By clicking on Select Tools you can enable/disable these tools.  For the purposes of this blog post, I have already selected only the memory tool to simplify the screenshots.

Image 4428 2

Notice that in the bottom pane there is an option to enable heap snapshots on the next debugging session:

Image 4571 3

By default, the native snapshots are disabled to preserve runtime performance while debugging.  The description in the center of the lower pane explains what this feature does and the inherent performance impact:

Image 3731 5

Once the snapshots toggle has been set to Yes, restart the debugger and the snapshot reel will work on your subsequent debugging sessions:

Image 8836 4


Native vs. Managed: Differences in Heap Analysis Overhead

Since the managed memory collector does not experience the processing overhead until the end of the collection, the runtime impact is negligible so heap snapshots are enabled by default.  Due to the fact that both memory tools share a checkbox in the Diagnostic Tools window, we added the additional option for native apps to enable snapshots for future debug sessions to preserve F5 runtime performance.  In the tool’s native allocation tracing process, there is a constant penalty in terms of runtime performance.  Depending on the number and usage of allocations, the runtime slowdown could range anywhere from around 20% to as high as about three times for an allocation intensive app(based on our initial tests).  Such runtime overhead is unfortunately inevitable in a memory allocation tracking tool and comparable to other tools available today.

In the future we plan to have a set of options for the Memory Usage tool where developers can enable native heap snapshots before starting a debugging session on an app, similar to what is available in the earlier version of the memory profiler:

Now with 64-bit support!

There were multiple requests for 64-bit profiling support on my last blog post, so I am very pleased to announce that we now support profiling:

  • 64-bit native Win32 projects
  • 64-bit managed desktop projects

Windows Store 64-bit profiling support is coming soon. Please try out the tool and let us know what you think!



Adam Welch

Visual C++ Team




Discussion is closed.

Feedback usabilla icon