guile-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

guile/guile-core/libguile gc.c


From: Marius Vollmer
Subject: guile/guile-core/libguile gc.c
Date: Thu, 06 Sep 2001 04:11:31 -0700

CVSROOT:        /cvs
Module name:    guile
Changes by:     Marius Vollmer <address@hidden> 01/09/06 04:11:31

Modified files:
        guile-core/libguile: gc.c 

Log message:
        (scm_done_free): Always subtract size from scm_mallocated
        when computing nm, even if it's negative.
        (scm_must_malloc): Abort on overflow of scm_mtrigger.
        (scm_must_realloc): Likewise.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/guile/guile-core/libguile/gc.c.diff?cvsroot=OldCVS&tr1=1.215&tr2=1.216&r1=text&r2=text

Patches:
Index: guile/guile-core/libguile/gc.c
diff -u guile/guile-core/libguile/gc.c:1.215 
guile/guile-core/libguile/gc.c:1.216
--- guile/guile-core/libguile/gc.c:1.215        Fri Aug 31 07:42:31 2001
+++ guile/guile-core/libguile/gc.c      Thu Sep  6 04:11:31 2001
@@ -1059,8 +1059,6 @@
   /* 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;
@@ -1985,11 +1983,15 @@
   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);
@@ -2053,10 +2055,13 @@
     {
       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);
@@ -2158,7 +2163,7 @@
          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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]