Deallocation hooks might trigger recursive GC - forbid that.
This commit is contained in:
committed by
Nikolay Igotti
parent
2a77459f48
commit
c1a41c9dc4
@@ -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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user