From 6080b8742a8aa3c54dc6b709df9af03dd850feaa Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sun, 8 Sep 2024 13:39:40 +0200 Subject: [PATCH] Fix memory leak. --- profiler/src/profiler/TracyView_FlameGraph.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/profiler/src/profiler/TracyView_FlameGraph.cpp b/profiler/src/profiler/TracyView_FlameGraph.cpp index bc3f5fda..6ce66fe3 100644 --- a/profiler/src/profiler/TracyView_FlameGraph.cpp +++ b/profiler/src/profiler/TracyView_FlameGraph.cpp @@ -90,6 +90,15 @@ static void SortFlameGraph( Vector& data ) for( auto& v : data ) SortFlameGraph( v.children ); } +static void FreeVector( Vector& data ) +{ + for( auto& v : data ) + { + FreeVector( v.children ); + v.children.~Vector(); + } +} + struct FlameGraphContext { ImDrawList* draw; @@ -217,6 +226,7 @@ void View::DrawFlameGraph() ImGui::EndChild(); ImGui::End(); + FreeVector( data ); } }