bug-guile
[Top][All Lists]
Advanced

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

Re: GC missed a reference


From: Marius Vollmer
Subject: Re: GC missed a reference
Date: Tue, 18 May 2004 23:22:45 +0200
User-agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3 (gnu/linux)

Bill Schottstaedt <address@hidden> writes:

> On the <GC missed a reference> bug reported earilier,
> in hashtab.c, in rehash_after_gc, to_rehash is set to
> SCM_EOL, the rehash list is processed, then the weak_hashtables
> list is set to to_rehash -- this clobbers the entire list!

Ouch, that's clearly a bug.

> I think the line (287 in the version I have) should be:
>
>        weak_hashtables = last;

Hmm, that would only put 'last' back in the list of weak_hashtables.
I think it should be:

      SCM first = to_rehash, last, h;
      /* important to clear to_rehash here so that we don't get stuck
         in an infinite loop if scm_i_rehash causes GC */
      to_rehash = SCM_EOL;
      h = first;
      do
        {
          scm_i_rehash (h,
                        /* use same hash_fn and closure as last time */
                        SCM_HASHTABLE (h)->hash_fn,
                        SCM_HASHTABLE (h)->closure,
                        "rehash_after_gc");
          last = h;
          h = SCM_HASHTABLE_NEXT (h);
        } while (!SCM_NULLP (h));
      /* move tables back to weak_hashtables */
      SCM_SET_HASHTABLE_NEXT (last, weak_hashtables);
      weak_hashtables = first;

I.e., we need to remember the first hashtab originally pointed to by
t_rehash.

Can you try that variant?  I have comitted it to HEAD.

-- 
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3  331E FAF8 226A D5D4 E405




reply via email to

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