guile-devel
[Top][All Lists]
Advanced

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

[PATCH] Fixing `gc-live-object-stats'


From: Ludovic Courtès
Subject: [PATCH] Fixing `gc-live-object-stats'
Date: Thu, 17 Nov 2005 14:21:32 +0100
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux)

Hi,

address@hidden (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  <address@hidden>

        * 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;





reply via email to

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