共用方式為


Memory Allocation Profiling is Managed Only!

People have been discovering that the VS Team System profiler can collect allocation data for an application.  It isn't long after that they discover that it only works on managed code, not native.  Sadly, the documentation is not clear on this.

The memory alloction profiling support in VSTS uses the profiler API provided by the CLR.  This gives us a rich set of information that allows us to track the lifetimes of individual objects.  There is no such off-the-shelf support in native memory management, since there are nearly as many heap implementations as there are applications in the world.

Memory allocation profiling is a much bigger deal for managed code, as the CLR has effectively turned what used to be a correctness issue (leaks, double frees, etc) into performance issues (excessive GCs and memory pressure)*.  This does not mean that some kind memory allocation profiling wouldn't benefit the world, but the combination of it being less important and more difficult keeps it out of the product for now.

If you think you are facing memory issues in native code, there is at least one utility I can offer up: In the server resource kits, the vadump utility can give you information about your virtual address space, including memory allocated by VirtualAlloc.

https://www.microsoft.com/downloads/details.aspx?FamilyID=9d467a69-57ff-4ae7-96ee-b18c4790cffd&DisplayLang=en

Unfortunately, this is a pale shadow (if that) of what you can get from the managed side.

* The idea that correctness issues become performance issues as we develop more advanced runtimes was something I heard David Detlefs mention somewhere.

Comments

  • Anonymous
    December 13, 2006
    In self-serving comment :), you can try AQTime from www.automatedqa.com.  It profiles both managed and unmanaged code and intergrates with VS

  • Anonymous
    December 21, 2006
    The comment has been removed