/* During the critical section, only the current thread may run. */
SCM_CRITICAL_SECTION_START;
- /* fprintf (stderr, "gc: %s\n", what); */
-
if (!scm_stack_base || scm_block_gc)
{
--scm_gc_running_p;
if (NULL != ptr)
{
scm_mallocated = nm;
+
if (nm > scm_mtrigger - SCM_MTRIGGER_HYSTERESIS) {
+ unsigned long old_trigger = scm_mtrigger;
if (nm > scm_mtrigger)
scm_mtrigger = nm + nm / 2;
else
scm_mtrigger += scm_mtrigger / 2;
+ if (scm_mtrigger < old_trigger)
+ abort ();
}
#ifdef GUILE_DEBUG_MALLOC
scm_malloc_register (ptr, what);
{
scm_mallocated = nm;
if (nm > scm_mtrigger - SCM_MTRIGGER_HYSTERESIS) {
+ unsigned long old_trigger = scm_mtrigger;
if (nm > scm_mtrigger)
scm_mtrigger = nm + nm / 2;
else
scm_mtrigger += scm_mtrigger / 2;
+ if (scm_mtrigger < old_trigger)
+ abort ();
}
#ifdef GUILE_DEBUG_MALLOC
scm_malloc_reregister (where, ptr, what);
scm_mallocated, which underflowed. */
abort ();
} else {
- unsigned long nm = scm_mallocated + size;
+ unsigned long nm = scm_mallocated - size;
if (nm < size)
/* The byte count of allocated objects has overflowed. This is
probably because you forgot to report the correct size of freed