From 01e1b0f7b71acac9b21bfbd47bd5f4ab480826db Mon Sep 17 00:00:00 2001 From: Noah Martin Date: Tue, 22 Oct 2024 09:33:43 -0400 Subject: [PATCH] Fix memory leak (#102) --- ETTrace/Tracer/EMGStackTraceRecorder.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ETTrace/Tracer/EMGStackTraceRecorder.cpp b/ETTrace/Tracer/EMGStackTraceRecorder.cpp index d00243d..9e726ca 100644 --- a/ETTrace/Tracer/EMGStackTraceRecorder.cpp +++ b/ETTrace/Tracer/EMGStackTraceRecorder.cpp @@ -101,4 +101,7 @@ void EMGStackTraceRecorder::recordStackForAllThreads(bool recordAllThreads, thre size_t endIndex = addressStorage.size(); emplaceResult.first->second.stacks.emplace_back(time, startIndex, endIndex); } + if (recordAllThreads) { + vm_deallocate(mach_task_self(), (vm_address_t) threads, sizeof(thread_t) * threadCount); + } }