Monthly Archives: November 2010

Debugging Memory Leaks, part 3.5: Hacks with Hooks

Alan rightfully comments that setting a conditional breakpoint at _heap_alloc_dbg  significantly slows down the application. If run time is an issue for you even in debug builds and re-compilation is not an issue, here’s an alternative trick: use an allocation … Continue reading

Posted in Debugging, VC++ | 1 Comment

Debugging Memory Leaks, Part 3: Breaking on Allocations of Given Size

When battling memory leaks, you often start from the output of _CrtMemDumpAllObjectsSince or _CrtDumpMemoryLeaks (called for you if you use MFC) – something similar to: C:\myfile.cpp(20): {130} normal block at 0x00780E80, 68 bytes long. Data: < > CD CD CD … Continue reading

Posted in Debugging, VC++ | 3 Comments

Checking Memory Corruption with _CrtCheckMemory – From the Debugger

Edit: In VS2015+ versions this trick is still useful but is a bit different.

Posted in Debugging, VC++, Visual Studio | 2 Comments

/d1reportAllClassLayout – Dumping Object Memory Layout

Roman just posted a nice investigation he did, mostly using the g++ switch -fdump-class-hierarchy – which dumps to stdout a graphical representation of generated classes layout. VC++ has no official similar switch, but deep inside  its undocumented pile of goodies … Continue reading

Posted in Debugging, VC++ | 3 Comments