diff --git a/server/TracyEvent.hpp b/server/TracyEvent.hpp index a21793f5..4fe0744c 100644 --- a/server/TracyEvent.hpp +++ b/server/TracyEvent.hpp @@ -66,6 +66,8 @@ enum { SourceLocationSize = sizeof( SourceLocation ) }; struct ZoneEvent { + void Init() { memset( &child, 0, 12 ); } + int64_t start; int64_t end; int32_t srcloc; @@ -77,6 +79,7 @@ struct ZoneEvent }; enum { ZoneEventSize = sizeof( ZoneEvent ) }; +static_assert( sizeof( ZoneEvent::child ) == 13, "Adjust vector clear size!" ); struct LockEvent diff --git a/server/TracyVector.hpp b/server/TracyVector.hpp index 162d6993..34dc37fd 100644 --- a/server/TracyVector.hpp +++ b/server/TracyVector.hpp @@ -174,6 +174,7 @@ private: { memUsage.fetch_add( sizeof( T ), std::memory_order_relaxed ); m_ptr = new T[1]; + m_capacity = 0; } else { diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 086b0441..bcf99732 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -615,7 +615,8 @@ void View::Process( const QueueItem& ev ) void View::ProcessZoneBegin( const QueueZoneBegin& ev ) { - auto zone = m_slab.AllocInit(); + auto zone = m_slab.Alloc(); + zone->Init(); CheckSourceLocation( ev.srcloc ); @@ -636,7 +637,8 @@ void View::ProcessZoneBeginAllocSrcLoc( const QueueZoneBegin& ev ) auto it = m_pendingSourceLocationPayload.find( ev.srcloc ); assert( it != m_pendingSourceLocationPayload.end() ); - auto zone = m_slab.AllocInit(); + auto zone = m_slab.Alloc(); + zone->Init(); zone->start = ev.time * m_timerMul; zone->end = -1; @@ -3845,7 +3847,9 @@ void View::ReadTimeline( FileRead& f, Vector& vec ) for( uint64_t i=0; i(); + auto zone = m_slab.Alloc(); + zone->Init(); + m_zonesCnt++; vec.push_back( zone );