Bug: GC is not reentrant

As the GC is not reentrant, finalizers should not be able to invoke it.
This commit is contained in:
Roberto Ierusalimschy
2021-12-13 10:41:17 -03:00
parent 1de95e97ef
commit 0bfc572e51
9 changed files with 57 additions and 27 deletions

View File

@@ -787,11 +787,8 @@ following the reverse order that they were marked.
If any finalizer marks objects for collection during that phase,
these marks have no effect.
Finalizers cannot yield.
Except for that, they can do anything,
such as raise errors, create new objects,
or even run the garbage collector.
However, because they can run in unpredictable times,
Finalizers cannot yield nor run the garbage collector.
Because they can run in unpredictable times,
it is good practice to restrict each finalizer
to the minimum necessary to properly release
its associated resource.
@@ -3276,6 +3273,8 @@ Returns the previous mode (@id{LUA_GCGEN} or @id{LUA_GCINC}).
For more details about these options,
see @Lid{collectgarbage}.
This function should not be called by a finalizer.
}
@APIEntry{lua_Alloc lua_getallocf (lua_State *L, void **ud);|
@@ -6233,6 +6232,8 @@ A zero means to not change that value.
See @See{GC} for more details about garbage collection
and some of these options.
This function should not be called by a finalizer.
}
@LibEntry{dofile ([filename])|