diff --git a/Grid/allocator/MemoryManager.cc b/Grid/allocator/MemoryManager.cc index a9e5c9b4..30a24c9c 100644 --- a/Grid/allocator/MemoryManager.cc +++ b/Grid/allocator/MemoryManager.cc @@ -16,6 +16,44 @@ NAMESPACE_BEGIN(Grid); 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__ + struct mallinfo mi; // really want mallinfo2, but glibc version isn't uniform + + mi = mallinfo(); + + std::cout << "MemoryManager: Total non-mmapped bytes (arena): "<< (size_t)mi.arena<