Hi,

[EMAIL PROTECTED] (Ludovic Courtès) writes:

>   $ guile
>   guile> (gc-live-object-stats)
>   Segmentation fault (core dumped)

The patch below fixes this problem.  Basically, what happens when doing
this is that `scm_i_card_statistics ()' gets called on yet uninitialized
cards.  This is normal because cards are initialized lazily at sweep
time by `scm_i_sweep_some_cards ()' which calls
`scm_i_init_card_freelist ()' if needed.

BTW, looking at the code of `scm_i_sweep_some_cards ()', it looks like
cards can be initialized more than once in the event where THRESHOLD is
reached before NEXT_FREE reached the upper boundary of SEG.  In such a
case, SEG->FIRST_TIME will remain equal to 1, and thus, the next time
this function is called on SEG, `scm_i_init_card_freelist ()' will be
called again for each of SEG's cards.

Did I miss something?

Thanks,
Ludovic.


2005-11-17  Ludovic Courtès  <[EMAIL PROTECTED]>

        * gc-card.c (scm_i_card_statistics): Return if BITVEC is NULL.
        This was typically hit when running `gc-live-object-stats' right
        after starting Guile.


--- orig/libguile/gc-card.c
+++ mod/libguile/gc-card.c
@@ -306,6 +306,10 @@
   int span = seg->span;
   int offset = SCM_MAX (SCM_GC_CARD_N_HEADER_CELLS, span);
 
+  if (!bitvec)
+    /* Card P hasn't been initialized yet by `scm_i_init_card_freelist ()'. */
+    return;
+
   for (p += offset; p < end; p += span, offset += span)
     {
       scm_t_bits tag = -1;



_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel

Reply via email to