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

Use big allocation mode for Vector's reserve_exact.

This commit is contained in:
Bartosz Taudul
2019-02-15 01:58:23 +01:00
parent 930190f2cb
commit 7b023e533d
2 changed files with 25 additions and 28 deletions
+6 -9
View File
@@ -9,6 +9,7 @@
#include "../common/TracyForceInline.hpp"
#include "TracyMemory.hpp"
#include "TracyPopcnt.hpp"
#include "TracySlab.hpp"
namespace tracy
{
@@ -46,15 +47,11 @@ public:
~Vector()
{
if( m_capacity == std::numeric_limits<uint8_t>::max() )
{
memUsage.fetch_sub( m_size * sizeof( T ) );
}
else
if( m_capacity != std::numeric_limits<uint8_t>::max() )
{
memUsage.fetch_sub( Capacity() * sizeof( T ), std::memory_order_relaxed );
delete[] m_ptr;
}
delete[] m_ptr;
}
Vector& operator=( const Vector& ) = delete;
@@ -234,13 +231,13 @@ public:
m_size = sz;
}
tracy_force_inline void reserve_exact( uint32_t sz )
template<size_t U>
tracy_force_inline void reserve_exact( uint32_t sz, Slab<U>& slab )
{
assert( !m_ptr );
m_capacity = std::numeric_limits<uint8_t>::max();
m_size = sz;
m_ptr = new T[sz];
memUsage.fetch_add( sz * sizeof( T ) );
m_ptr = (T*)slab.AllocBig( sizeof( T ) * sz );
}
tracy_force_inline void clear()