GCC memory leak detection equivalent to Microsoft crtdbg.h?

后端 未结 7 2023
悲&欢浪女
悲&欢浪女 2020-12-13 04:41

After many years of working on a general-purpose C++ library using the Microsoft MSVC compiler in Visual Studio, we are now porting it to Linux/Mac OS X (pray for us). I hav

相关标签:
7条回答
  • 2020-12-13 05:18

    Since some time both clang and gcc support some "sanitizers", including the leak sanitizer. When enabled during compilation, the code is instrumented by the compiler to perform the respective checks during run-time. On gcc the leak sanitizer is enabled using "-fsanitize=leak". See https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.html.

    0 讨论(0)
提交回复
热议问题