bug-guile
[Top][All Lists]
Advanced

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

bug#9900: local vars not cleaned


From: Stefan Israelsson Tampe
Subject: bug#9900: local vars not cleaned
Date: Sun, 30 Oct 2011 19:49:56 +0100



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



reply via email to

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