mirror of
https://github.com/wolfpld/tracy
synced 2025-05-05 22:53:52 +00:00
Initialize rpmalloc in Mem{Alloc,Free}Callstack().
rpmalloc may still be uninitialized here (i.e. if memory allocation/free is performed before any other tracy operation that would initialize thread_local data). Since memory allocations are using serialized queue (which is not held in thread_local section) and obtaining callstack involves memory allocation, we need to initialize rpmalloc manually. This won't be a problem when support for zone callbacks becomes online, because zones are stored in per-thread queues, which initialize thread_local data before rpmalloc is needed in the Callstack() call.
This commit is contained in:
parent
3f7ab10323
commit
0c13fb818b
@ -220,6 +220,7 @@ public:
|
||||
{
|
||||
const auto thread = GetThreadHandle();
|
||||
|
||||
rpmalloc_thread_initialize();
|
||||
s_profiler.m_serialLock.lock();
|
||||
SendMemAlloc( QueueType::MemAllocCallstack, thread, ptr, size );
|
||||
SendCallstackMemory( depth );
|
||||
@ -230,6 +231,7 @@ public:
|
||||
{
|
||||
const auto thread = GetThreadHandle();
|
||||
|
||||
rpmalloc_thread_initialize();
|
||||
s_profiler.m_serialLock.lock();
|
||||
SendMemFree( QueueType::MemFreeCallstack, thread, ptr );
|
||||
SendCallstackMemory( depth );
|
||||
|
Loading…
x
Reference in New Issue
Block a user