且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

查找堆损坏

更新时间:2023-01-15 21:08:46

使用Microsoft运行时库的调试版本。打开红色区域,并在初始化过程中通过调用 _CrtSetDbgFlag()一次,在128个(说)堆操作中自动检查堆。

Use the debug version of the Microsoft runtime libraries. Turn on red-zoning and get your heap automatically checked every 128 (say) heap operations by calling _CrtSetDbgFlag() once during initialisation.

_CRTDBG_DELAY_FREE_MEM_DF 可以非常有用的找到内存使用后的免费bug,但是你的堆大小在使用它时单调增长。

_CRTDBG_DELAY_FREE_MEM_DF can be quite useful for finding memory-used-after-free bugs, but your heap size grows monitonically while using it.