diff --git a/src/machine.cpp b/src/machine.cpp index c06d8c8159..5e08655898 100644 --- a/src/machine.cpp +++ b/src/machine.cpp @@ -3458,6 +3458,8 @@ object allocate3(Thread* t, Allocator* allocator, Machine::AllocationType type, unsigned sizeInBytes, bool objectMask) { + expect(t, t->criticalLevel == 0); + if (UNLIKELY(t->flags & Thread::UseBackupHeapFlag)) { expect(t, t->backupHeapIndex + ceiling(sizeInBytes, BytesPerWord) <= ThreadBackupHeapSizeInWords);