Skip to content

Commit 0416cd0

Browse files
committed
Merge pull request #24 from github/vmg/lazy-sweep
gc: Do not finish lazy sweeps when freeing the object space
2 parents a4d63d8 + 1ae7449 commit 0416cd0

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

gc.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -920,7 +920,8 @@ static void heap_page_free(rb_objspace_t *objspace, struct heap_page *page);
920920
void
921921
rb_objspace_free(rb_objspace_t *objspace)
922922
{
923-
gc_rest_sweep(objspace);
923+
if (is_lazy_sweeping(heap_eden))
924+
rb_bug("lazy sweeping underway when freeing object space");
924925

925926
if (objspace->profile.records) {
926927
free(objspace->profile.records);
@@ -2255,6 +2256,12 @@ rb_objspace_call_finalizer(rb_objspace_t *objspace)
22552256
st_free_table(finalizer_table);
22562257
finalizer_table = 0;
22572258
ATOMIC_SET(finalizing, 0);
2259+
2260+
/*
2261+
* finish any lazy sweeps that may have been started
2262+
* when finalizing the objects in the heap
2263+
*/
2264+
gc_rest_sweep(objspace);
22582265
}
22592266

22602267
static inline int

0 commit comments

Comments
 (0)