How to ignore false positive memory leaks from _CrtDumpMemoryLeaks?

后端 未结 7 1264
[愿得一人]
[愿得一人] 2020-12-03 11:41

It seems whenever there are static objects, _CrtDumpMemoryLeaks returns a false positive claiming it is leaking memory. I know this is because they do not get destroyed unti

7条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-03 12:15

    Ach. If you are sure that _CrtDumpMemoryLeaks() is lying, then you are probably correct. Most alleged memory leaks that I see are down to incorect calls to _CrtDumpMemoryLeaks(). I agree entirely with the following; _CrtDumpMemoryLeaks() dumps all open handles. But your program probably already has open handles, so be sure to call _CrtDumpMemoryLeaks() only when all handles have been released. See http://www.scottleckie.com/2010/08/_crtdumpmemoryleaks-and-related-fun/ for more info.

提交回复
热议问题