Per-project natvis files in Visual Studio “14”

Visual Studio 2012 introduced a new framework for writing debugger visualizers for C++ types that replaced the old autoexp.dat file. The new framework offers xml syntax, better diagnostics, versioning and multiple file support. Visualizers are defined in XML files with extension .natvis. These visualizers are loaded each time the debugger starts. That means if you … Read more

Visual Studio 2012 Debugger Visualizer for CPtrArray

CPtrArray is a nasty MFC container that should not be used. However, if you deal with legacy code you may not have a choice and have to work with it. Unfortunately, the Visual Studio debugger is not able to display its elements, since these are pointers to void and that can be anything. In this … Read more

How to Find the Source of Memory Leaks

When you run your (unmanaged/C++) application in debugger, you see at the end a report of memory leaks (if any are detected). Something like this: Detected memory leaks! Dumping objects -> f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(141) : {381} normal block at 0x001FFC30, 54 bytes long. Data: < x > 0C 00 B9 78 12 00 00 00 12 00 … Read more