summaryrefslogtreecommitdiffstats
path: root/gc.c
diff options
context:
space:
mode:
Diffstat (limited to 'gc.c')
-rw-r--r--gc.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/gc.c b/gc.c
index 5b1bdcd3..19032cbe 100644
--- a/gc.c
+++ b/gc.c
@@ -700,7 +700,17 @@ static val call_finalizers_impl(val ctx,
while (found) {
struct fin_reg *next = found->next;
- funcall1(found->fun, found->obj);
+ val obj = found->obj;
+ funcall1(found->fun, obj);
+#if CONFIG_GEN_GC
+ /* Note: here an object may be added to freshobj more than once, since
+ * multiple finalizers can be registered.
+ */
+ if (freshobj_idx < FRESHOBJ_VEC_SIZE && obj->t.gen == 0)
+ freshobj[freshobj_idx++] = obj;
+ else
+ full_gc = 1;
+#endif
free(found);
found = next;
ret = t;