From b360098319ea038521bf6ead9fa3f1a1f9e2288c Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Fri, 24 Apr 2015 07:47:59 -0700 Subject: * gc.c (make_obj, gc): The check for insufficient space in freshobj array after a gc is moved into the gc function. --- ChangeLog | 5 +++++ gc.c | 7 ++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3bb62fec..e5b44930 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2015-04-24 Kaz Kylheku + + * gc.c (make_obj, gc): The check for insufficient space in freshobj + array after a gc is moved into the gc function. + 2015-04-24 Kaz Kylheku * gc.c (gc): Minor off-by-one: compare gc_counter to FULL_GC_INTERVAL diff --git a/gc.c b/gc.c index 11078aaa..799bbf94 100644 --- a/gc.c +++ b/gc.c @@ -173,8 +173,6 @@ val make_obj(void) malloc_delta >= opt_gc_delta) { gc(); - if (freshobj_idx >= FRESHOBJ_VEC_SIZE) - full_gc = 1; prev_malloc_bytes = malloc_bytes; } #else @@ -665,10 +663,13 @@ void gc(void) printf("sweep: freed %d full_gc == %d exhausted == %d\n", (int) swept, full_gc, exhausted); #endif - if (++gc_counter >= FULL_GC_INTERVAL) { + if (++gc_counter >= FULL_GC_INTERVAL || + freshobj_idx >= FRESHOBJ_VEC_SIZE) + { full_gc_next_time = 1; gc_counter = 0; } + if (exhausted && full_gc && swept < 3 * HEAP_SIZE / 4) more(); #else -- cgit v1.2.3