From ba911c661c4a3607c80dcd0c30d4313e558a9243 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sun, 27 Sep 2015 10:25:54 -0700 Subject: Full gc should be done if driven by malloc. * gc.c (gc): If the number of bytes malloced since the last gc exceeds the gc delta, we must do do a full garbage collection. The mature generation is almost certainly holding on to a lot of that memory. A test case for this is (lazy-str-force (lazy-str (get-lines (open-file "file")))). The file doesn't even have to be very large. --- gc.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gc.c b/gc.c index af91bba7..9128e9d9 100644 --- a/gc.c +++ b/gc.c @@ -674,6 +674,11 @@ void gc(void) assert (gc_enabled); +#if CONFIG_GEN_GC + if (malloc_bytes - prev_malloc_bytes >= opt_gc_delta) + full_gc = 1; +#endif + save_context(mc); gc_enabled = 0; mark(&mc, &gc_stack_top); -- cgit v1.2.3