1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:38:11 +00:00

LibJS: Assert if garbage collection is restarted while ongoing

We can't GC while we're already in GC. Assert if this happens.
This commit is contained in:
Andreas Kling 2020-09-21 14:35:19 +02:00
parent df3ff76815
commit c8baf29d82
2 changed files with 5 additions and 0 deletions

View file

@ -89,6 +89,9 @@ Cell* Heap::allocate_cell(size_t size)
void Heap::collect_garbage(CollectionType collection_type, bool print_report)
{
ASSERT(!m_collecting_garbage);
TemporaryChange change(m_collecting_garbage, true);
Core::ElapsedTimer collection_measurement_timer;
collection_measurement_timer.start();
if (collection_type == CollectionType::CollectGarbage) {