1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-16 16:50:21 +02:00

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.
This commit is contained in:
Andy Wingo 2011-11-29 21:36:31 +01:00
parent 9f7537dcab
commit fd51e66190
3 changed files with 40 additions and 1 deletions

View file

@ -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)