Han-Wen Nienhuys <[EMAIL PROTECTED]> 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


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

Reply via email to