Why are strings linked lists?

Simon Marlow simonmar at microsoft.com
Mon Dec 8 16:45:38 EST 2003


 
> But then... what trick does GHC use to prevent CAF leaks?

No tricks really, the garbage collector traces references from code as
well as references from the heap to find all the live data.  Of course,
it doesn't actually examine the code; each code segment comes with a
list of top-level closures that it references, called an SRT (static
reference table).

In a standalone program, we know that only CAFs which are referenced by
code which is reachable from the current machine state (i.e. the stack)
will ever be used again.  In an interpreted system it is more difficult:
we don't know what expressions will be typed at the prompt in the
future.

Cheers,
	Simon



More information about the Haskell mailing list