From c1aaec32d62198f4f0d382179098fad07d84abb1 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Mon, 2 Apr 2018 15:45:11 +0200 Subject: [PATCH] Sort active allocations by appearance time. --- server/TracyView.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 1188d27b..92351bcc 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -3870,9 +3870,17 @@ void View::DrawMemory() ImGui::Separator(); if( ImGui::TreeNode( "Active allocations" ) ) { - ListMemData( mem.active.begin(), mem.active.end(), []( auto& v ) { - ImGui::Text( "0x%" PRIx64, v->second->ptr ); - return v->second; + std::vector items; + items.reserve( mem.active.size() ); + for( auto& v : mem.active ) + { + items.emplace_back( v.second ); + } + std::sort( items.begin(), items.end(), []( const auto& lhs, const auto& rhs ) { return lhs->timeAlloc > rhs->timeAlloc; } ); + + ListMemData( items.begin(), items.end(), []( auto& v ) { + ImGui::Text( "0x%" PRIx64, (*v)->ptr ); + return *v; } ); ImGui::TreePop(); }