summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--gc.c7
2 files changed, 9 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 3bb62fec..e5b44930 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2015-04-24 Kaz Kylheku <kaz@kylheku.com>
+ * 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 <kaz@kylheku.com>
+
* gc.c (gc): Minor off-by-one: compare gc_counter to FULL_GC_INTERVAL
rather than FULL_GC_INTERVAL - 1, since it is pre-incremented.
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