mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-27 00:04:35 +00:00
Merge pull request #197 from jwdevel/use-rpmalloc-in-ProfilerThreadDataKey
Use tracy_malloc rather than 'new' in ProfilerThreadDataKey
This commit is contained in:
commit
207a48e986
@ -1069,7 +1069,9 @@ public:
|
|||||||
void* p = pthread_getspecific(m_key);
|
void* p = pthread_getspecific(m_key);
|
||||||
if (!p)
|
if (!p)
|
||||||
{
|
{
|
||||||
p = new ProfilerThreadData(GetProfilerData());
|
RPMallocInit init;
|
||||||
|
p = (ProfilerThreadData*)tracy_malloc( sizeof( ProfilerThreadData ) );
|
||||||
|
new (p) ProfilerThreadData(GetProfilerData());
|
||||||
pthread_setspecific(m_key, p);
|
pthread_setspecific(m_key, p);
|
||||||
}
|
}
|
||||||
return *static_cast<ProfilerThreadData*>(p);
|
return *static_cast<ProfilerThreadData*>(p);
|
||||||
@ -1079,7 +1081,8 @@ private:
|
|||||||
|
|
||||||
static void sDestructor(void* p)
|
static void sDestructor(void* p)
|
||||||
{
|
{
|
||||||
delete static_cast<ProfilerThreadData*>(p);
|
((ProfilerThreadData*)p)->~ProfilerThreadData();
|
||||||
|
tracy_free(p);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user