Skip to content

Commit

Permalink
Merge pull request #24 from github/vmg/lazy-sweep
Browse files Browse the repository at this point in the history
gc: Do not finish lazy sweeps when freeing the object space
  • Loading branch information
dbussink committed Jan 29, 2015
2 parents a4d63d8 + 1ae7449 commit 0416cd0
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -920,7 +920,8 @@ static void heap_page_free(rb_objspace_t *objspace, struct heap_page *page);
void
rb_objspace_free(rb_objspace_t *objspace)
{
gc_rest_sweep(objspace);
if (is_lazy_sweeping(heap_eden))
rb_bug("lazy sweeping underway when freeing object space");

if (objspace->profile.records) {
free(objspace->profile.records);
Expand Down Expand Up @@ -2255,6 +2256,12 @@ rb_objspace_call_finalizer(rb_objspace_t *objspace)
st_free_table(finalizer_table);
finalizer_table = 0;
ATOMIC_SET(finalizing, 0);

/*
* finish any lazy sweeps that may have been started
* when finalizing the objects in the heap
*/
gc_rest_sweep(objspace);
}

static inline int
Expand Down

0 comments on commit 0416cd0

Please sign in to comment.