Another question about sharing

Simon Marlow simonmar@microsoft.com
Mon, 10 Dec 2001 14:49:56 -0000


> I'm curious, how does GHC determine that the CAF is no longer required
> if it is referenced by code (somehow)? If code was also some kind of
> heap allocated data structure I guess this would be possible, but I
> thought this wasn't so with GHC.

GHC actually tracks references to top-level entities from code, so that
the GC can trace the transitive closure of live code and hence find all
the reachable CAFs.  It's a real pain, but worth it.

> But in any case, I'm not sure this really helps me. I don't really
> mind if the unreduced form of the CAF is garbage collected or not
> (it's only going to be a few words of memory). The effect I'm trying
> to get is to ensure that the (partially) reduced form of the CAF only
> lives as long as any (non code) heap object which references it.
> Does that make sense? (probably not:-)

If I understand correctly, that's the behaviour you'll get with GHC, and
(I think) nhc98.

Cheers,
	Simon