How to force VS 2010 to break when corrupting the heap in debug?
-
06-03-2021 - |
Question
according to MSDN, Visual Studio uses a special heap in debug mode that has extra "no man's land" bytes set to 0xFD by default to track heap corruption Is there a way to force visual to break when such values are overwritten? I can't find this information anywhere and it seems extremely useful, much more than having to manually dump the memstat like MSDN proposes
thanks
Solution
You could try using _CrtSetDbgFlag()
when in debug mode.
OTHER TIPS
If you want to pause execution the next time a place in memory is changed then set a data breakpoint. You need to know in advance where the corruption will occur. You maybe need to set a regular break point where a memory is allocated and where no man's land is set to 0xFD. After that point you have a location in memory, and just set the data breakpoint.
Why don't you use AppVerifier with your application?