[Haskell-cafe] ghci: Difference in garbage collection etc. between REPL and function

Brandon Allbery allbery.b at gmail.com
Thu May 9 16:26:57 CEST 2013


On Thu, May 9, 2013 at 10:19 AM, Niklas Hambüchen <mail at nh2.me> wrote:

> On 09/05/13 20:50, Brandon Allbery wrote:
> > ghci is in many ways like an endless (or at least until ":l"/":r")
> > do-block. In particular, the handle remains in scope after you run your
> > commands at the prompt, so it is not garbage collected.  If you enclose
> > it into its own do block, this introduces local scope and the handle
> > goes out of scope and is garbage collected at the end.
>
> I am not sure how the handle is relevant - I do not expect it to garbage
> collected before the close or rely on that, and my problem happens
> earlier already.
>

You said 'garbage in the handle'... but in any case it applies to all the
bindings, not just to that one. Generalize.

-- 
brandon s allbery kf8nh                               sine nomine associates
allbery.b at gmail.com                                  ballbery at sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130509/12bc91a8/attachment.htm>


More information about the Haskell-Cafe mailing list