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

Separate slab init/noinit allocation functions.

This commit is contained in:
Bartosz Taudul
2017-10-21 12:54:12 +02:00
parent ad338a7cfd
commit 07cb693cbb
2 changed files with 11 additions and 5 deletions
+8 -2
View File
@@ -30,7 +30,7 @@ public:
}
}
void* Alloc( size_t size )
void* AllocRaw( size_t size )
{
assert( size <= BlockSize );
if( m_offset + size > BlockSize )
@@ -45,10 +45,16 @@ public:
return ret;
}
template<typename T>
T* AllocInit()
{
return new( AllocRaw( sizeof( T ) ) ) T;
}
template<typename T>
T* Alloc()
{
return new( Alloc( sizeof( T ) ) ) T;
return (T*)AllocRaw( sizeof( T ) );
}
void Unalloc( size_t size )