rhymu8354 / SystemAbstractions

This is library contains classes which are either common utilities or wrap common operating system services whose interfaces vary from one operating system to another.
MIT License
8 stars 4 forks source link

Add wrapper for memory leak detection #9

Open rhymu8354 opened 4 years ago

rhymu8354 commented 4 years ago

For example, in Windows, Microsoft CRT functions can detect memory leaks like this:

#ifdef _WIN32
#include <crtdbg.h>
#endif /* _WIN32 */

int main(int argc, char* argv[]) {
    // Set up to catch memory leaks.
#ifdef _WIN32
    //_crtBreakAlloc = 18;
    _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
#endif /* _WIN32 */
rhymu8354 commented 4 years ago

Neui recommendation:

"[13:20] Neui: For memory leaks I also suggested DrMemory and LeakSanitizer"