1
0
mirror of https://github.com/wolfpld/tracy.git synced 2025-03-20 07:40:02 +08:00

Merge pull request #197 from jwdevel/use-rpmalloc-in-ProfilerThreadDataKey

Use tracy_malloc rather than 'new' in ProfilerThreadDataKey
This commit is contained in:
Bartosz Taudul
2021-04-12 19:35:24 +02:00
committed by GitHub
+5 -2
View File
@@ -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<ProfilerThreadData*>(p);
@@ -1079,7 +1081,8 @@ private:
static void sDestructor(void* p)
{
delete static_cast<ProfilerThreadData*>(p);
((ProfilerThreadData*)p)->~ProfilerThreadData();
tracy_free(p);
}
};