void HeapSnapshotBuilder::buildSnapshot() { PreventCollectionScope preventCollectionScope(m_profiler.vm().heap); m_snapshot = std::make_unique<HeapSnapshot>(m_profiler.mostRecentSnapshot()); { m_profiler.setActiveSnapshotBuilder(this); m_profiler.vm().heap.collectAllGarbage(); m_profiler.setActiveSnapshotBuilder(nullptr); } m_snapshot->finalize(); m_profiler.appendSnapshot(WTFMove(m_snapshot)); }
void HeapSnapshotBuilder::buildSnapshot() { // GCDebuggingSnapshot are always full snapshots, so clear any existing snapshots. if (m_snapshotType == SnapshotType::GCDebuggingSnapshot) m_profiler.clearSnapshots(); PreventCollectionScope preventCollectionScope(m_profiler.vm().heap); m_snapshot = std::make_unique<HeapSnapshot>(m_profiler.mostRecentSnapshot()); { m_profiler.setActiveSnapshotBuilder(this); m_profiler.vm().heap.collectNow(Sync, CollectionScope::Full); m_profiler.setActiveSnapshotBuilder(nullptr); } m_snapshot->finalize(); m_profiler.appendSnapshot(WTFMove(m_snapshot)); }