diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2015-09-27 10:25:54 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2015-09-27 10:25:54 -0700 |
commit | ba911c661c4a3607c80dcd0c30d4313e558a9243 (patch) | |
tree | 18dea7bbd3ea0813320997e901ab40511b540438 | |
parent | e5145afe93cd5290878ac432aea87da9c70d1263 (diff) | |
download | txr-ba911c661c4a3607c80dcd0c30d4313e558a9243.tar.gz txr-ba911c661c4a3607c80dcd0c30d4313e558a9243.tar.bz2 txr-ba911c661c4a3607c80dcd0c30d4313e558a9243.zip |
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.
-rw-r--r-- | gc.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -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); |