mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 02:31:48 +00:00
Add table initializing alloc to slab allocator.
This commit is contained in:
parent
59632f0d37
commit
781ebeb835
@ -58,6 +58,26 @@ public:
|
||||
return (T*)ret;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
T* AllocInit( size_t sz )
|
||||
{
|
||||
const auto size = sizeof( T ) * sz;
|
||||
assert( size <= BlockSize );
|
||||
if( m_offset + size > BlockSize )
|
||||
{
|
||||
DoAlloc();
|
||||
}
|
||||
void* ret = m_ptr + m_offset;
|
||||
T* ptr = (T*)ret;
|
||||
for( size_t i=0; i<sz; i++ )
|
||||
{
|
||||
new( ptr ) T;
|
||||
ptr++;
|
||||
}
|
||||
m_offset += size;
|
||||
return (T*)ret;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
tracy_force_inline T* Alloc()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user