guile-devel
[Top][All Lists]
Advanced

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

Re: module GC bug


From: Marius Vollmer
Subject: Re: module GC bug
Date: Thu, 07 Jul 2005 21:42:00 +0300
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

Han-Wen Nienhuys <address@hidden> writes:

> Hi,
>
> I've found a memory leak in GUILE.
>
> The contents of modules are not garbage collected.
>
> This seems to be related with two errors:
>
>   - scm_stand_in_procs is a hashtable. I believe it should be weak_key
> hashtable, just like the scm_object_whash table. For, if a closure is
> GC'd, so should it properties.

Yes.

>   - in boot-9.scm, set-module-eval-closure! does
>
>       (set-procedure-property! closure 'module module))
>
> So the closure is a key in a weak hash-table, pointing to the module
> as a value (using scm_stand_in_procs), the module is always marked
> during GC. However, since the module points back to the closure via
> the 'eval-closure slot, the key is always marked. Consequently,
> neither closure nor module are ever GC'd.
>
> I've fixed this by introducing a new function (eval-closure-module)
> which returns the module of a closure via the eval-closure smob.

I think the right fix is to change the weak hashtable marking
algorithm to properly cope with circular references like this.  I will
try this and then come back to you.  (I don't know how long this might
take since the required changes look to be slightly non-trivial (but
entirely possible).)

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




reply via email to

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