mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-26 07:54:36 +00:00
Separate slab init/noinit allocation functions.
This commit is contained in:
parent
ad338a7cfd
commit
07cb693cbb
@ -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 )
|
||||
|
@ -568,7 +568,7 @@ void View::Process( const QueueItem& ev )
|
||||
|
||||
void View::ProcessZoneBegin( const QueueZoneBegin& ev )
|
||||
{
|
||||
auto zone = m_slab.Alloc<Event>();
|
||||
auto zone = m_slab.AllocInit<Event>();
|
||||
|
||||
CheckSourceLocation( ev.srcloc );
|
||||
|
||||
@ -713,7 +713,7 @@ void View::ProcessPlotData( const QueuePlotData& ev )
|
||||
auto pit = m_pendingPlots.find( ev.name );
|
||||
if( pit == m_pendingPlots.end() )
|
||||
{
|
||||
plot = m_slab.Alloc<PlotData>();
|
||||
plot = m_slab.AllocInit<PlotData>();
|
||||
plot->name = ev.name;
|
||||
plot->enabled = true;
|
||||
m_pendingPlots.emplace( ev.name, plot );
|
||||
@ -3052,7 +3052,7 @@ void View::ReadTimeline( FileRead& f, Vector<Event*>& vec, Event* parent, const
|
||||
|
||||
for( uint64_t i=0; i<sz; i++ )
|
||||
{
|
||||
auto zone = m_slab.Alloc<Event>();
|
||||
auto zone = m_slab.AllocInit<Event>();
|
||||
m_zonesCnt++;
|
||||
vec.push_back( zone );
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user