From 930190f2cbdd1ebcb468e2013e0195f565ab503f Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Fri, 15 Feb 2019 01:48:33 +0100 Subject: [PATCH] Support big allocations in slab allocator. --- server/TracySlab.hpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/server/TracySlab.hpp b/server/TracySlab.hpp index d66a4a4a..74da3162 100644 --- a/server/TracySlab.hpp +++ b/server/TracySlab.hpp @@ -75,6 +75,23 @@ public: m_offset -= size; } + tracy_force_inline void* AllocBig( size_t size ) + { + if( m_offset + size <= BlockSize ) + { + void* ret = m_ptr + m_offset; + m_offset += size; + return ret; + } + else + { + memUsage.fetch_add( size ); + auto ret = new char[size]; + m_buffer.emplace_back( ret ); + return ret; + } + } + void Reset() { if( m_buffer.size() > 1 )