diff --git a/Grid/allocator/MemoryManager.cc b/Grid/allocator/MemoryManager.cc index c71f3512..e56af238 100644 --- a/Grid/allocator/MemoryManager.cc +++ b/Grid/allocator/MemoryManager.cc @@ -17,6 +17,21 @@ uint64_t total_shared; uint64_t total_device; uint64_t total_host;; +#if defined(__has_feature) +#if __has_feature(leak_sanitizer) +#define ASAN_LEAK_CHECK +#endif +#endif + +#ifdef ASAN_LEAK_CHECK +#include +#include +#include +#define LEAK_CHECK(A) { __lsan_do_recoverable_leak_check(); } +#else +#define LEAK_CHECK(A) { } +#endif + void MemoryManager::DisplayMallinfo(void) { #ifdef __linux__ @@ -24,17 +39,19 @@ void MemoryManager::DisplayMallinfo(void) mi = mallinfo(); - printf("Total non-mmapped bytes (arena): %d\n", mi.arena); - printf("# of free chunks (ordblks): %d\n", mi.ordblks); - printf("# of free fastbin blocks (smblks): %d\n", mi.smblks); - printf("# of mapped regions (hblks): %d\n", mi.hblks); - printf("Bytes in mapped regions (hblkhd): %d\n", mi.hblkhd); - printf("Max. total allocated space (usmblks): %d\n", mi.usmblks); - printf("Free bytes held in fastbins (fsmblks): %d\n", mi.fsmblks); - printf("Total allocated space (uordblks): %d\n", mi.uordblks); - printf("Total free space (fordblks): %d\n", mi.fordblks); - printf("Topmost releasable block (keepcost): %d\n", mi.keepcost); + std::cout << "MemoryManager: Total non-mmapped bytes (arena): "<< (size_t)mi.arena<