diff --git a/client/TracyProfiler.cpp b/client/TracyProfiler.cpp index bcf43942..e8e98c14 100644 --- a/client/TracyProfiler.cpp +++ b/client/TracyProfiler.cpp @@ -1069,7 +1069,9 @@ public: void* p = pthread_getspecific(m_key); if (!p) { - p = new ProfilerThreadData(GetProfilerData()); + RPMallocInit init; + p = (ProfilerThreadData*)tracy_malloc( sizeof( ProfilerThreadData ) ); + new (p) ProfilerThreadData(GetProfilerData()); pthread_setspecific(m_key, p); } return *static_cast(p); @@ -1079,7 +1081,8 @@ private: static void sDestructor(void* p) { - delete static_cast(p); + ((ProfilerThreadData*)p)->~ProfilerThreadData(); + tracy_free(p); } };