Add a leak hunting achievement.

This commit is contained in:
Bartosz Taudul
2026-10-15 22:39:01 +02:00
parent 745bed8477
commit bf74c4cb8d
4 changed files with 20 additions and 1 deletions

View File

@@ -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)

View File

@@ -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!

View File

@@ -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 };

View File

@@ -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<const MemEvent*> items;
items.reserve( mem.active.size() );