mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-23 06:44:35 +00:00
Fitted zone vectors are now magic vectors.
The pointed-to zones in the original children vector can't be freed, so they are put into a zone pool for re-use by future zones.
This commit is contained in:
parent
4f962d2fcc
commit
ae33aa4869
@ -3647,8 +3647,16 @@ void Worker::ProcessZoneEnd( const QueueZoneEnd& ev )
|
|||||||
if( sz <= 8 * 1024 )
|
if( sz <= 8 * 1024 )
|
||||||
{
|
{
|
||||||
Vector<short_ptr<ZoneEvent>> fitVec;
|
Vector<short_ptr<ZoneEvent>> fitVec;
|
||||||
fitVec.reserve_exact( sz, m_slab );
|
fitVec.set_magic();
|
||||||
memcpy( fitVec.data(), childVec.data(), sz * sizeof( short_ptr<ZoneEvent> ) );
|
auto& fv = *((Vector<ZoneEvent>*)&fitVec);
|
||||||
|
fv.reserve_exact( sz, m_slab );
|
||||||
|
auto dst = fv.data();
|
||||||
|
for( auto& ze : childVec )
|
||||||
|
{
|
||||||
|
ZoneEvent* src = ze;
|
||||||
|
memcpy( dst++, src, sizeof( ZoneEvent ) );
|
||||||
|
m_zoneEventPool.push_back( src );
|
||||||
|
}
|
||||||
fitVec.swap( childVec );
|
fitVec.swap( childVec );
|
||||||
m_data.zoneVectorCache.push_back( std::move( fitVec ) );
|
m_data.zoneVectorCache.push_back( std::move( fitVec ) );
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user