guile-devel
[Top][All Lists]
Advanced

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

[PATCH] Accurate count of freed cells


From: Ludovic Courtès
Subject: [PATCH] Accurate count of freed cells
Date: Tue, 20 Dec 2005 14:16:43 +0100
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux)

Hi,

The patch below fixes the way freed cells are counted in
`scm_i_sweep_card ()'.  Basically, without this patch, FREE_COUNT is
incremented regardless of whether the cell pointed to by SCMPTR was
already free or not.

Thanks,
Ludovic.


2005-12-20  Ludovic Courtès  <address@hidden>

        * gc-card.c (scm_i_sweep_card): Only increment FREE_COUNT for
        cells that were really freed.


--- orig/libguile/gc-card.c
+++ mod/libguile/gc-card.c
@@ -255,10 +255,13 @@
          abort();
        }
 
+      if (SCM_CELL_TYPE (scmptr) != scm_tc_free_cell)
+       /* Only account for cells that were really freed.  */
+       free_count ++;
+
       SCM_GC_SET_CELL_WORD (scmptr, 0, scm_tc_free_cell);        
       SCM_SET_FREE_CELL_CDR (scmptr, PTR2SCM (*free_list));
       *free_list = scmptr;
-      free_count ++;
     }
 
   return free_count;




reply via email to

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