summaryrefslogtreecommitdiff
path: root/runtime/contrib/heap_trace/src/free_stub.cc
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/contrib/heap_trace/src/free_stub.cc')
-rw-r--r--runtime/contrib/heap_trace/src/free_stub.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/runtime/contrib/heap_trace/src/free_stub.cc b/runtime/contrib/heap_trace/src/free_stub.cc
index 31af63c8a..21c311dfd 100644
--- a/runtime/contrib/heap_trace/src/free_stub.cc
+++ b/runtime/contrib/heap_trace/src/free_stub.cc
@@ -16,6 +16,7 @@
#include "trace.h"
#include "function_resolver.h"
+#include "memory_pool_for_symbol_searcher_internals.h"
#include <memory>
@@ -25,6 +26,12 @@ extern "C" {
void free(void *p) noexcept
{
+ MemoryPoolForSymbolSearcherInternals pool;
+ if (pool.containsMemorySpaceStartedFromPointer(p))
+ {
+ return pool.deallocate(p);
+ }
+
static auto originalFunction = findFunctionByName<void, void *>("free");
originalFunction(p);
if (!Trace::Guard{}.isActive())