From: | Hans-Peter Diettrich <DrDiettrich1@aol.com> |
Newsgroups: | comp.compilers,comp.lang.functional |
Date: | 28 Apr 2007 23:30:35 -0400 |
Organization: | Compilers Central |
References: | 07-04-074 07-04-084 07-04-109 07-04-125 07-04-134 |
Keywords: | Java, functional, design |
Posted-Date: | 28 Apr 2007 23:30:35 EDT |
Torben Ęgidius Mogensen wrote:
> In SML and similar langauges with updatable references, you can build
> and manipulate graph nodes and edges directly. If a part of the graph
> becomes unreachable from the root set, it is GC'ed.
A note, applicable to many languages:
Graph transformations are one reason, why GC requires RTTI. Imagine
that you want to move a node around in the tree. Since it cannot
reside in two places at the same time, you have to remove it first,
and ... bang!?
That's why a mark-sweep collector must know about e.g. parameters and
local variables in subroutines, where a reference to the above node
will prevent it from being collected. When a garbage collector
searches the entire call stack for possible object references, it can
find false references, e.g. locations containing patterns that look
like an object reference. Fortunately that's quite harmless, such a
misinterpretation will never cause an object to be collected. More
annoying were unaligned references, where every byte in the stack
could be the first byte of a reference. Such guessing also disallows
copy-collection, because then a false hit will result in a modifaction
of an unrelated value, when the object is moved during GC.
DoDi
Return to the
comp.compilers page.
Search the
comp.compilers archives again.