Slab allocator is not thread safe.

This commit is contained in:
Bartosz Taudul 2018-06-24 17:10:46 +02:00
parent 3fba965c3c
commit ab2945b988

View File

@ -555,6 +555,7 @@ Worker::Worker( FileRead& f, EventType::Type eventMask )
if( fileVer == 0 && f.IsEOF() ) return;
f.Read( sz );
bool reconstructMemAllocPlot = false;
if( eventMask & EventType::Memory )
{
m_data.memory.data.reserve_and_use( sz );
@ -601,7 +602,7 @@ Worker::Worker( FileRead& f, EventType::Type eventMask )
if( sz != 0 )
{
m_threadMemory = std::thread( [this] { ReconstructMemAllocPlot(); } );
reconstructMemAllocPlot = true;
}
}
else
@ -631,7 +632,7 @@ Worker::Worker( FileRead& f, EventType::Type eventMask )
f.Skip( sizeof( MemData::high ) + sizeof( MemData::low ) + sizeof( MemData::usage ) );
}
if( fileVer <= FileVersion( 0, 3, 1 ) ) return;
if( fileVer <= FileVersion( 0, 3, 1 ) ) goto finishLoading;
f.Read( sz );
m_data.callstackPayload.reserve( sz );
@ -664,6 +665,12 @@ Worker::Worker( FileRead& f, EventType::Type eventMask )
m_data.callstackFrameMap.emplace( ptr, frame );
}
finishLoading:
if( reconstructMemAllocPlot )
{
m_threadMemory = std::thread( [this] { ReconstructMemAllocPlot(); } );
}
}
template<class T>