GNU bug report logs - #9900
Using a guardian on a value in a weak hash

Previous Next

Package: guile;

Reported by: Ian Price <ianprice90 <at> googlemail.com>

Date: Fri, 28 Oct 2011 20:47:02 UTC

Severity: normal

Done: Andy Wingo <wingo <at> pobox.com>

Bug is archived. No further changes may be made.

Full log


Message #17 received at 9900 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Israelsson Tampe <stefan.itampe <at> gmail.com>
To: 9900 <at> debbugs.gnu.org
Subject: Re: bug#9900: local vars not cleaned
Date: Sun, 30 Oct 2011 19:49:56 +0100
[Message part 1 (text/plain, inline)]
Sorry to spam the list.

But beeing a little ignorant how guile works, makes this a discovering
procedure.

So locals is always allocated from the stack. This is what happens with
Ians code.

A program is executed and a set of locals is allocated on the stack for the
duration of the loading, this means that during the
whole execution of the loaded file the locals variables are below the stack
pointer and hence always contains a reference from the stack to the last
used objects in the local variables. This can be seen by loading the file
and then do an explicit gc on the repl. and then check the guardian. Then
because the sp pointer is now below the locals in the loaded file they can
be gc:ed and is also returned by calls to the guardian.

What can be done?

1. One can push the constructors into functions that are called from the
toplevel in the code
2. One can patch guile so that used locals in let constructs are cleaned at
the end of the let form in
    a) toplevel let
    b) all let

So the question now is if this is going to be fixed or if it is going to be
a subtle point that can trick
advanced users of guile but work most of the time in the name of speed.

what do you think?

/Stefan
[Message part 2 (text/html, inline)]

This bug report was last modified 13 years and 156 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.