Add a memory pools achievement.

This commit is contained in:
Bartosz Taudul
2026-10-31 18:13:32 +01:00
parent a4595ee85d
commit a51bb8c738
4 changed files with 17 additions and 1 deletions
+1
View File
@@ -227,6 +227,7 @@ 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)
Embed(PROFILER_FILES TextMemory src/achievements/Memory.md TEXT)
Embed(PROFILER_FILES TextMemoryPools src/achievements/MemoryPools.md TEXT)
Embed(PROFILER_FILES TextNameThreads src/achievements/NameThreads.md TEXT)
Embed(PROFILER_FILES TextLightFlame src/achievements/LightFlame.md TEXT)
Embed(PROFILER_FILES TextPlots src/achievements/Plots.md TEXT)
+7
View File
@@ -0,0 +1,7 @@
# Separate pools
An application rarely allocates from a single heap: the C runtime provides `malloc`, a graphics API manages device memory on its own, and a script VM runs its allocator. Report all of it through plain `TracyAlloc` and the usage curve is a single total that hides which heap is which.
[`TracyAllocN( ptr, size, name )` and `TracyFreeN( ptr, name )`](#memorypools) attribute events to the pool named by `name`, a [unique pointer to a string literal](#uniquepointers) like every other Tracy string. Every pool gets its own usage plot above the timeline, and once a second pool shows up the [Memory window](#memorywindow) grows a * Memory pool* selector, so its lists, memory map and call stack trees describe that pool alone.
Switch to your named pool and see what it holds. Try it out!
@@ -25,6 +25,7 @@
#include "data/TextLocks.hpp"
#include "data/TextManual.hpp"
#include "data/TextMemory.hpp"
#include "data/TextMemoryPools.hpp"
#include "data/TextNameThreads.hpp"
#include "data/TextPlots.hpp"
#include "data/TextReadAssembly.hpp"
@@ -77,7 +78,13 @@ AchievementItem ai_allocStacks = {
.text = Unpack( TextAllocStacks )
};
AchievementItem* ac_trackMemoryItems[] = { &ai_huntLeaks, &ai_allocStacks, nullptr };
AchievementItem ai_memoryPools = {
.id = "memoryPools",
.name = "Separate pools",
.text = Unpack( TextMemoryPools )
};
AchievementItem* ac_trackMemoryItems[] = { &ai_huntLeaks, &ai_allocStacks, &ai_memoryPools, nullptr };
AchievementItem ai_trackMemory = {
.id = "trackMemory",
@@ -191,6 +191,7 @@ void View::DrawMemory()
{
if( ImGui::Selectable( v.first == 0 ? "Default allocator" : m_worker.GetString( v.first ) ) )
{
if( s_config.achievements && v.first != 0 ) Achieve( "memoryPools" );
m_memInfo.pool = v.first;
m_memInfo.showAllocList = false;
}