2
0
mirror of https://github.com/wolfpld/tracy synced 2026-01-19 04:52:09 +00:00

Fix unknown allocation message in debug due to alloc name litteral not pointing to the same location

This commit is contained in:
Clément Grégoire
2025-12-16 19:49:08 +01:00
parent 7976e6ab0b
commit 16558f2915

View File

@@ -49,16 +49,18 @@ void operator delete( void* ptr ) noexcept
free( ptr );
}
// We need to have the same pointer for both TracyAllocNS and TracyFreeNS
static const char* customAllocStr = "Custom alloc";
void* CustomAlloc( size_t count )
{
auto ptr = malloc( count );
TracyAllocNS( ptr, count, 10, "Custom alloc" );
TracyAllocNS( ptr, count, 10, customAllocStr );
return ptr;
}
void CustomFree( void* ptr )
{
TracyFreeNS( ptr, 10, "Custom alloc" );
TracyFreeNS( ptr, 10, customAllocStr );
free( ptr );
}