mirror of
https://github.com/wolfpld/tracy.git
synced 2026-10-23 01:00:54 +00:00
Add a leak hunting achievement.
This commit is contained in:
@@ -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)
|
||||
|
||||
7
profiler/src/achievements/Leaks.md
Normal file
7
profiler/src/achievements/Leaks.md
Normal 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!
|
||||
@@ -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 };
|
||||
|
||||
@@ -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() );
|
||||
|
||||
Reference in New Issue
Block a user