diff options
author | Peter Zhu <[email protected]> | 2023-12-12 10:45:59 -0500 |
---|---|---|
committer | Peter Zhu <[email protected]> | 2023-12-13 10:39:06 -0500 |
commit | f8ddcecbdf34b8d33ed4311b34d498d4ff380a3e (patch) | |
tree | e89f99d7dcb034f4aea9388c617580ab95cf6374 /gc.c | |
parent | 0d53dba7ce900387397610c060cfa24758fc806a (diff) |
[Bug #20061] Clear mark bits when rb_free_on_exit
When compiling with cppflags=-DRGENGC_CHECK_MODE, the following crashes:
```
$ RUBY_FREE_ON_EXIT=1 ./miniruby -e 0
-e: [BUG] obj_free: RVALUE_MARKED(0x0000000103570020 [3LM ] T_CLASS (anon)) != FALSE
```
This commit clears the mark bits when rb_free_on_exit is enabled.
Diffstat (limited to 'gc.c')
-rw-r--r-- | gc.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -4651,6 +4651,14 @@ rb_objspace_call_finalizer(rb_objspace_t *objspace) /* Abort incremental marking and lazy sweeping to speed up shutdown. */ gc_abort(objspace); + if (rb_free_on_exit) { + for (int i = 0; i < SIZE_POOL_COUNT; i++) { + rb_size_pool_t *size_pool = &size_pools[i]; + rb_heap_t *heap = SIZE_POOL_EDEN_HEAP(size_pool); + rgengc_mark_and_rememberset_clear(objspace, heap); + } + } + /* prohibit GC because force T_DATA finalizers can break an object graph consistency */ dont_gc_on(); |