From 8eb51aa01d1fbb220e15148bc2690e08f8f316fb Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Tue, 29 Sep 2020 15:10:55 +0200 Subject: [PATCH] Get LFQ item before capturing callstack. This is to ensure that thread local structures have been properly initialized (lock-free queue buffers are thread local), as capturing callstack involves allocating memory from rpmalloc, which must be initialized in each thread before allocation. --- client/TracyProfiler.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/client/TracyProfiler.cpp b/client/TracyProfiler.cpp index af72b270..57dc828d 100644 --- a/client/TracyProfiler.cpp +++ b/client/TracyProfiler.cpp @@ -2825,10 +2825,9 @@ void Profiler::ReportTopology() void Profiler::SendCallstack( int depth, const char* skipBefore ) { #ifdef TRACY_HAS_CALLSTACK + TracyLfqPrepare( QueueType::Callstack ); auto ptr = Callstack( depth ); CutCallstack( ptr, skipBefore ); - - TracyLfqPrepare( QueueType::Callstack ); MemWrite( &item->callstackFat.ptr, (uint64_t)ptr ); TracyLfqCommit; #endif