Merge pull request #6450 from 4ertus2/some

Fix memory tracking under sanitizers
This commit is contained in:
alexey-milovidov 2019-08-12 22:28:34 +03:00 committed by GitHub
commit fbcb5f5d31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,3 +1,4 @@
#include <malloc.h>
#include <new>
#include <common/config_common.h>
@ -49,6 +50,11 @@ ALWAYS_INLINE void untrackMemory(void * ptr [[maybe_unused]], std::size_t size [
#else
if (size)
CurrentMemoryTracker::free(size);
#ifdef _GNU_SOURCE
/// It's innaccurate resource free for sanitizers. malloc_usable_size() result is greater or equal to allocated size.
else
CurrentMemoryTracker::free(malloc_usable_size(ptr));
#endif
#endif
}
catch (...)