OpenAmiga (815/964)

From:Ole Friis Ostergaard
Date:25 Sep 2000 at 13:32:16
Subject:Re: AMIOPEN: XML and Java, a uncharted territory?

Jim Peters wrote:
>
> On Fri, Sep 22, 2000 at 08:31:35AM +0200, Juan Carlos Marcos Rodr�guez wrote:
> > > I can't possibly tolerate everything stopping dead every
> > > now and then for it to garbage-collect.
> >
> > This garbage collection issue is not a thing that can get done in the
> > background, right? Why is it?
>
> If you take the normal mark-and-sweep approach to garbage collection,
> or one of those related techniques, then you have to stop everything
> whilst you scan all allocated memory starting from references in
> global variables picking up references and following them until you
> have found all memory that is still in use. At this point you can
> start everything going again, and toss out all the allocated memory
> which was not referenced.
>
> You have to stop everything, because otherwise the running code could
> move a reference from unscanned memory into already-scanned memory,
> meaning that the garbage collector wouldn't see it, and would
> incorrectly free that chunk.
>
> There are ways around this, but lots of trade-offs, and things start
> getting really complex.

"Really complex" shouldn't be an excuse for not doing it right :-)

Sun's HotSpot engine by default uses a deviation of mark-and-sweep
called mark-compact which may cause some noticeable breaks in the
program execution. The difference between mark-sweep and mark-compact is
(as the name implies) that mark-compact moves the living object together
on the heap, thus avoiding fragmentation problems.

However, HotSpot can also be told to use the so-called Train algorithm
which is non-disruptive (well, normally is, at least). If you want to
run interactive applications on the HotSpot engine, you should turn on
the Train algorithm, and if you're running a non-interactive benchmark
program, you should use mark-compact.

So, the bottom line is: If you choose the Train algorithm in Hotspot,
you shouldn't experience garbage collection breaks. Does anybody
experience this anyway?



Ole Friis �stergaard <olef@daimi.au.dk>
For unge til at f�le ansvaret tynge
som andet end d�rlig samvittighed
(Steffen Brandt)
Subscribe/Unsubscribe: open-request@amiga.com
Amiga FAQ: http://www.amiga.com/faq.html