From d07db80b441ca196aaadeada42c9a558715fea6f Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sun, 13 Jun 2021 12:15:36 +0200 Subject: [PATCH] Fix rpmalloc init for shared libraries. --- client/TracyAlloc.cpp | 9 ++++++++- common/TracyAlloc.hpp | 8 +------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/client/TracyAlloc.cpp b/client/TracyAlloc.cpp index eb94dd8d..0106a01a 100644 --- a/client/TracyAlloc.cpp +++ b/client/TracyAlloc.cpp @@ -3,15 +3,17 @@ #include #include "../common/TracyAlloc.hpp" +#include "../common/TracyForceInline.hpp" #include "../common/TracyYield.hpp" namespace tracy { +extern thread_local bool RpThreadInitDone; extern std::atomic RpInitDone; extern std::atomic RpInitLock; -TRACY_API void InitRpmallocPlumbing() +tracy_no_inline static void InitRpmallocPlumbing() { const auto done = RpInitDone.load( std::memory_order_acquire ); if( !done ) @@ -30,6 +32,11 @@ TRACY_API void InitRpmallocPlumbing() RpThreadInitDone = true; } +TRACY_API void InitRpmalloc() +{ + if( !RpThreadInitDone ) InitRpmallocPlumbing(); +} + } #endif diff --git a/common/TracyAlloc.hpp b/common/TracyAlloc.hpp index 27861c97..0ee01716 100644 --- a/common/TracyAlloc.hpp +++ b/common/TracyAlloc.hpp @@ -13,13 +13,7 @@ namespace tracy { #ifdef TRACY_ENABLE -extern thread_local bool RpThreadInitDone; -TRACY_API void InitRpmallocPlumbing(); - -static tracy_force_inline void InitRpmalloc() -{ - if( !RpThreadInitDone ) InitRpmallocPlumbing(); -} +TRACY_API void InitRpmalloc(); #endif static inline void* tracy_malloc( size_t size )