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

* gc-segment.c (scm_i_make_initial_segment): check user settings

for sanity.

* gc-malloc.c (scm_gc_init_malloc): check user settings for
sanity.
(scm_gc_register_collectable_memory): prevent overflow of memory
counts.

* gc-freelist.c (scm_init_freelist): check user settings for sanity.

* gc-malloc.c (scm_gc_register_collectable_memory): use floats;
these won't ever wrap around with high memory usage.

* gc-freelist.c: include <stdio.h>

* gc-malloc.c: add DEBUGINFO for mtrigger GCs.
This commit is contained in:
Han-Wen Nienhuys 2002-09-05 21:55:33 +00:00
parent ffd724008b
commit dac04e9fb9
5 changed files with 42 additions and 11 deletions

View file

@ -106,6 +106,14 @@ scm_gc_init_malloc (void)
SCM_DEFAULT_INIT_MALLOC_LIMIT);
scm_i_minyield_malloc = scm_getenv_int ("GUILE_MIN_YIELD_MALLOC",
SCM_DEFAULT_MALLOC_MINYIELD);
if (scm_i_minyield_malloc >= 100)
scm_i_minyield_malloc = 99;
if (scm_i_minyield_malloc < 1)
scm_i_minyield_malloc = 1;
if (scm_mtrigger < 0)
scm_mtrigger = SCM_DEFAULT_INIT_MALLOC_LIMIT;
}
@ -226,7 +234,10 @@ scm_gc_register_collectable_memory (void *mem, size_t size, const char *what)
Instead of getting bogged down, we let the mtrigger grow
strongly with it.
*/
scm_mtrigger = (scm_mallocated * 110) / (100 - scm_i_minyield_malloc);
float no_overflow_trigger = (float)(scm_mallocated * 110);
no_overflow_trigger /= (float) (100 - scm_i_minyield_malloc);
scm_mtrigger = (unsigned long) no_overflow_trigger;
#ifdef DEBUGINFO
fprintf (stderr, "Mtrigger sweep: ineffective. New trigger %d\n", scm_mtrigger);