Bindings and Space leaks

Alastair David Reid reid@cs.utah.edu
04 Jul 2001 18:17:24 -0600


Janis Voigtlaender <voigt@orchid.inf.tu-dresden.de> writes:
> 2. In a '93 paper, Jan Sparud describes an implementation technique
> for avoiding space leaks when tuples are returned as function
> result, and the values accessed by pattern matching in bindings. The
> paper says this technique (of shorcircuiting all references via a
> tuple, the first time a tuple element is demanded) has been
> implemented in Chalmers LML/HBC compiler. What about other
> compilers, e.g. GHC?

GHC's garbage collector will "short-circuit" thunks of the form:

  selector@object where the object is in whnf

(If I remember the paper correctly) this is slightly different from
Jan Sparud's technique which did the short-circuiting in the evaluator.

I'm pretty sure Hugs doesn't implement either.  The GC version might
be straightforward to add.


-- 
Alastair Reid        reid@cs.utah.edu        http://www.cs.utah.edu/~reid/