From 0bfc572e51d9035a615ef6e9523f736c9ffa8e57 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Mon, 13 Dec 2021 10:41:17 -0300 Subject: Bug: GC is not reentrant As the GC is not reentrant, finalizers should not be able to invoke it. --- manual/manual.of | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'manual') diff --git a/manual/manual.of b/manual/manual.of index c9e62b49..c660215c 100644 --- a/manual/manual.of +++ b/manual/manual.of @@ -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])| -- cgit v1.2.3-55-g6feb