diff --git a/profiler/CMakeLists.txt b/profiler/CMakeLists.txt index dcdd4928..fc1aafd0 100644 --- a/profiler/CMakeLists.txt +++ b/profiler/CMakeLists.txt @@ -218,6 +218,7 @@ Embed(PROFILER_FILES TextInstrumentationIntro src/achievements/InstrumentationIn Embed(PROFILER_FILES TextInstrumentationStatistics src/achievements/InstrumentationStatistics.md TEXT) Embed(PROFILER_FILES TextInstrumentFrames src/achievements/InstrumentFrames.md TEXT) Embed(PROFILER_FILES TextIntro src/achievements/Intro.md TEXT) +Embed(PROFILER_FILES TextLeaks src/achievements/Leaks.md TEXT) Embed(PROFILER_FILES TextLoadTrace src/achievements/LoadTrace.md TEXT) Embed(PROFILER_FILES TextLocks src/achievements/Locks.md TEXT) Embed(PROFILER_FILES TextManual src/achievements/Manual.md TEXT) diff --git a/profiler/src/achievements/Leaks.md b/profiler/src/achievements/Leaks.md new file mode 100644 index 00000000..a9a6512e --- /dev/null +++ b/profiler/src/achievements/Leaks.md @@ -0,0 +1,7 @@ +# Hunt leaks + +A leak is memory your program allocated and never freed. Once your program has finished, everything still listed under `Active allocations` in the [Memory window](#memorywindow) is a leak, ordered by allocation time, with the total on the pane header. + +Click a block's address to open the [allocation information window](#memallocinfo) with its time, thread and zone data. Middle-clicking an allocation in the list zooms without opening the window. + +Let your program finish and expand `Active allocations`. Try it out! diff --git a/profiler/src/profiler/TracyAchievementData.cpp b/profiler/src/profiler/TracyAchievementData.cpp index b6c5a8b5..b7a3fb5c 100644 --- a/profiler/src/profiler/TracyAchievementData.cpp +++ b/profiler/src/profiler/TracyAchievementData.cpp @@ -14,6 +14,7 @@ #include "data/TextInstrumentationIntro.hpp" #include "data/TextInstrumentationStatistics.hpp" #include "data/TextIntro.hpp" +#include "data/TextLeaks.hpp" #include "data/TextLoadTrace.hpp" #include "data/TextLocks.hpp" #include "data/TextManual.hpp" @@ -55,10 +56,19 @@ AchievementItem ai_samplingIntro = { AchievementItem* ac_samplingItems[] = { &ai_samplingIntro, nullptr }; AchievementCategory ac_sampling = { "sampling", "Sampling", ac_samplingItems }; +AchievementItem ai_huntLeaks = { + .id = "huntLeaks", + .name = "Hunt leaks", + .text = Unpack( TextLeaks ) +}; + +AchievementItem* ac_trackMemoryItems[] = { &ai_huntLeaks, nullptr }; + AchievementItem ai_trackMemory = { .id = "trackMemory", .name = "Track memory", - .text = Unpack( TextMemory ) + .text = Unpack( TextMemory ), + .items = ac_trackMemoryItems }; AchievementItem* ac_memoryItems[] = { &ai_trackMemory, nullptr }; diff --git a/profiler/src/profiler/TracyView_Memory.cpp b/profiler/src/profiler/TracyView_Memory.cpp index 533ffaee..224454dc 100644 --- a/profiler/src/profiler/TracyView_Memory.cpp +++ b/profiler/src/profiler/TracyView_Memory.cpp @@ -333,6 +333,7 @@ void View::DrawMemory() ImGui::Separator(); if( ImGui::TreeNode( ICON_FA_HEART_PULSE " Active allocations" ) ) { + if( s_config.achievements ) Achieve( "huntLeaks" ); uint64_t total = 0; std::vector items; items.reserve( mem.active.size() );