diff options
author | Aaron Patterson <[email protected]> | 2019-10-07 12:28:21 -0700 |
---|---|---|
committer | Aaron Patterson <[email protected]> | 2019-10-07 12:28:21 -0700 |
commit | 6abcd35762db4bf49cd6c62a8c624e2a013e5dc1 (patch) | |
tree | 178acd740ca5f4cecaff9cafb988d042c6dc0a6a /gc.c | |
parent | 058db33c5ec881271d028b7490d88b3baed74acb (diff) |
Do not free too many pages.
Sweep step checks `heap_pages_freeable_pages`, so compaction should do
the same.
Diffstat (limited to 'gc.c')
-rw-r--r-- | gc.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -8409,10 +8409,12 @@ gc_compact_after_gc(rb_objspace_t *objspace, int use_toward_empty, int use_doubl RMOVED(moved_list)->next = 0; page->free_slots++; heap_page_add_freeobj(objspace, page, moved_list); - if (page->free_slots == page->total_slots) { + if (page->free_slots == page->total_slots && heap_pages_freeable_pages > 0) { heap_pages_freeable_pages--; heap_unlink_page(objspace, heap_eden, page); heap_add_page(objspace, heap_tomb, page); + } else if (page->free_slots == page->total_slots) { + page->free_next = NULL; } objspace->profile.total_freed_objects++; moved_list = next_moved; |