Author | Message | Time |
---|---|---|
Arta | Given that the file name and line number (presumeably where an allocation takes place) is stored on the debug heap in _CrtMemBlockHeader, shouldn't it be possible, when given a message such as... [code] DAMAGE: after Normal block (#2681) at 0x008AAB58. Normal located at 0x008AAB58 is 8 bytes long. [/code] ...to find the nomansland buffer in which the damage occurs and thus find the block header for the memory you allocated after which the damage occured? Surely this would be immensely useful? I don't see a function under 'Debug Functions' in the documentation that does this. | January 28, 2004, 7:36 PM |
Adron | Isn't that message printed as a debug string? | January 31, 2004, 12:36 PM |
Arta | Yes. I've looked into this further, however, and found that CRT debug stack code doesn't make use of those fields, it just sets them to NULL. I've tried using _CRTDBG_MAP_ALLOC as well, but that just seems to map everything to the line inside ::new. I used allocation breakpoints to figure it out instead. | January 31, 2004, 10:28 PM |
Adron | An alternative way would be to use windbg's heap debugging / page heap, and setting your application to use Windows' native heap. That way you can capture stack traces as well as breaking exactly when the corruption happens. | January 31, 2004, 10:49 PM |