From 1e645665fe67d066c4ab023f507f5b124ca0e150 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Wed, 18 Oct 2017 23:30:54 +0200 Subject: [PATCH] Initialize rpmalloc in profiler worker thread. Thread local variables on gcc are apparently not initialized on thread startup, but on first access to thread local variables block. Previously it was working, because s_token was accessed before any rpmalloc allocation could be performed. Now the first rpmalloc allocation is the Socket class, and rpmalloc is not initialized there, as there was no thread local access yet. --- client/TracyProfiler.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/client/TracyProfiler.cpp b/client/TracyProfiler.cpp index 6975ac70..7e890bc9 100644 --- a/client/TracyProfiler.cpp +++ b/client/TracyProfiler.cpp @@ -154,6 +154,8 @@ enum { BulkSize = TargetFrameSize / QueueItemSize }; void Profiler::Worker() { + rpmalloc_thread_initialize(); + const auto procname = GetProcessName(); const auto pnsz = std::min( strlen( procname ), WelcomeMessageProgramNameSize - 1 );