[Haskell-cafe] threepenny-gui: garbage collection

Tom Ellis tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk
Sat Jan 3 00:57:39 UTC 2015


Suppose that each time I make a particular threepenny-gui widget, call it a
`Foo`, I register an event handler using `on` so that the `Foo` can change
its appearance based on some `Event`.

Suppose I create, show, and hide a billion `Foo`s, each one never to be
shown again.  Can they be garbage collected?  Presumably there is something
storing the callback that was registered for the `Event` and the callback
refers to the `Foo`.  How then can the `Foo`s be freed?

`Reactive.Threepenny.register` talks about an "unregister" action but says
"FIXME: Unregistering event handlers does not work yet.".  But how could it
be known anyway when to unregister?  Is there not the possibility of a space
leak regardless?

Thanks,

Tom


More information about the Haskell-Cafe mailing list