From d7bfb30079cf8e3ef66ed92d02fc661c9cca024e Mon Sep 17 00:00:00 2001 From: King19931229 <562538332@qq.com> Date: Fri, 14 May 2021 18:48:02 +0800 Subject: [PATCH] Fix rpmalloc initializing problem in android --- client/TracyCallstack.cpp | 1 + client/TracyCallstack.hpp | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/client/TracyCallstack.cpp b/client/TracyCallstack.cpp index 4c87e6c7..e21d3893 100644 --- a/client/TracyCallstack.cpp +++ b/client/TracyCallstack.cpp @@ -163,6 +163,7 @@ void InitCallstack() TRACY_API uintptr_t* CallTrace( int depth ) { + InitRPMallocThread(); auto trace = (uintptr_t*)tracy_malloc( ( 1 + depth ) * sizeof( uintptr_t ) ); const auto num = RtlWalkFrameChain( (void**)( trace + 1 ), depth, 0 ); *trace = num; diff --git a/client/TracyCallstack.hpp b/client/TracyCallstack.hpp index f5d4231b..97e69ccd 100644 --- a/client/TracyCallstack.hpp +++ b/client/TracyCallstack.hpp @@ -21,6 +21,7 @@ namespace tracy { +TRACY_API void InitRPMallocThread(); struct CallstackSymbolData { @@ -83,6 +84,8 @@ static _Unwind_Reason_Code tracy_unwind_callback( struct _Unwind_Context* ctx, v static tracy_force_inline void* Callstack( int depth ) { + InitRPMallocThread(); + assert( depth >= 1 && depth < 63 ); auto trace = (uintptr_t*)tracy_malloc( ( 1 + depth ) * sizeof( uintptr_t ) ); @@ -98,6 +101,8 @@ static tracy_force_inline void* Callstack( int depth ) static tracy_force_inline void* Callstack( int depth ) { + InitRPMallocThread(); + assert( depth >= 1 ); auto trace = (uintptr_t*)tracy_malloc( ( 1 + (size_t)depth ) * sizeof( uintptr_t ) );