diff options
author | Bartosz Taudul <wolf.pld@gmail.com> | 2017-10-21 13:54:12 +0300 |
---|---|---|
committer | Bartosz Taudul <wolf.pld@gmail.com> | 2017-10-21 13:54:12 +0300 |
commit | 07cb693cbb7604906c3c8ba973d2c465cc731387 (patch) | |
tree | 5fcea7448fd7977dd945e11e3bb37d7a454b460e /server/TracySlab.hpp | |
parent | ad338a7cfd42ece83cc8d62bba8f478736e467eb (diff) |
Separate slab init/noinit allocation functions.
Diffstat (limited to 'server/TracySlab.hpp')
-rw-r--r-- | server/TracySlab.hpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/server/TracySlab.hpp b/server/TracySlab.hpp index e4f53815..cb85b663 100644 --- a/server/TracySlab.hpp +++ b/server/TracySlab.hpp @@ -30,7 +30,7 @@ public: } } - void* Alloc( size_t size ) + void* AllocRaw( size_t size ) { assert( size <= BlockSize ); if( m_offset + size > BlockSize ) @@ -46,9 +46,15 @@ public: } 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 ) |