Deallocation hooks might trigger recursive GC - forbid that.
This commit is contained in:
Igor Chevdar
2018-11-07 13:58:32 +03:00
committed by Nikolay Igotti
parent 2a77459f48
commit c1a41c9dc4
+4
View File
@@ -709,10 +709,14 @@ void ScanRoots(MemoryState* state) {
} }
void CollectRoots(MemoryState* state) { void CollectRoots(MemoryState* state) {
// Here we might free some objects and call deallocation hooks on them,
// which in turn might call DecrementRC and trigger new GC - forbid that.
state->gcSuspendCount++;
for (auto container : *(state->roots)) { for (auto container : *(state->roots)) {
container->resetBuffered(); container->resetBuffered();
CollectWhite(state, container); CollectWhite(state, container);
} }
state->gcSuspendCount--;
} }
void Scan(ContainerHeader* container) { void Scan(ContainerHeader* container) {