Space usage

Adrian Hey ahey at iee.org
Wed Aug 18 11:40:48 EDT 2004


On Tuesday 17 Aug 2004 5:11 pm, Malcolm Wallace wrote:
> It is also possible to use Wadler's
> garbage-collector fix for this space leak, as implemented in nhc98.
>     P Wadler, "Fixing a Space Leak with a Garbage Collector", SP&E Sept
> 1987.
>
> When the GC discovers a selector function applied to an evaluated
> argument, it "evaluates" the selector on-the-fly by just swizzling
> pointers.  It needs some co-operation from the compiler to make
> selector functions look obvious, but that isn't too difficult.

So ghc doesn't do this (or something better)? I'm surprised
because it seems like a really basic and simple feature to me. I
implemented a toy FPL a few years ago and even my gc incorporated
this optimisation. It's a bit strange that this should have been
overlooked considering in all other respects ghc is far more
sophisticated than my efforts were :-)

Regards
--
Adrian Hey



More information about the Glasgow-haskell-users mailing list