Right now, we place objects that need to be freed at shutdown into a weak list that is traversed at shutdown. This makes allocation slower and increases memory used.
Allocation:
|
mmtk_add_obj_free_candidate(alloc_obj); |
Shutdown:
|
struct MMTk_RawVecOfObjRef registered_candidates = mmtk_get_all_obj_free_candidates(); |
|
for (size_t i = 0; i < registered_candidates.len; i++) { |
|
VALUE obj = (VALUE)registered_candidates.ptr[i]; |
|
|
|
if (rb_gc_shutdown_call_finalizer_p(obj)) { |
|
rb_gc_obj_free(objspace_ptr, obj); |
|
} |
|
} |
|
mmtk_free_raw_vec_of_obj_ref(registered_candidates); |
Instead, we should use heap walking at shutdown to free these objects.
Right now, we place objects that need to be freed at shutdown into a weak list that is traversed at shutdown. This makes allocation slower and increases memory used.
Allocation:
ruby/gc/mmtk.c
Line 224 in 9903af4
Shutdown:
ruby/gc/mmtk.c
Lines 495 to 503 in 9903af4
Instead, we should use heap walking at shutdown to free these objects.