diff options
author | Andy Wingo <wingo@pobox.com> | 2011-11-29 21:36:31 +0100 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2011-11-29 21:36:31 +0100 |
commit | fd51e66190bde8cef74fec9725de4da3471901c4 (patch) | |
tree | 3fdacb8207c0579c81fcd9fc8117cce5ddcf95b3 /libguile/gc-malloc.c | |
parent | 9f7537dcabbded64afd631c0d57c84aced8173c5 (diff) | |
download | guile-fd51e66190bde8cef74fec9725de4da3471901c4.tar.gz |
attempt to handle steady-state mallocations better
* libguile/gc-malloc.c (scm_realloc): Call the new
scm_gc_register_allocation() here. If we have to collect, do a
GC_gcollect_and_unmap.
* libguile/gc.c (scm_gc_register_allocation): Add a routine to track
steady-state mallocation, and cause gc to run if there is a high
mallocation rate.
(adjust_gc_frequency): Reset the bytes-until-GC countdown timer.
Diffstat (limited to 'libguile/gc-malloc.c')
-rw-r--r-- | libguile/gc-malloc.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libguile/gc-malloc.c b/libguile/gc-malloc.c index c64ea2f33..a7dab2a7e 100644 --- a/libguile/gc-malloc.c +++ b/libguile/gc-malloc.c @@ -89,12 +89,14 @@ scm_realloc (void *mem, size_t size) { void *ptr; + scm_gc_register_allocation (size); + SCM_SYSCALL (ptr = realloc (mem, size)); if (ptr) return ptr; /* Time is hard: trigger a full, ``stop-the-world'' GC, and try again. */ - GC_gcollect (); + GC_gcollect_and_unmap (); SCM_SYSCALL (ptr = realloc (mem, size)); if (ptr) |