Precise GC (was Re: cannot build libjava/gnu/gcj/xlib/natClip.cc)

Cedric Berger cedric@wireless-networks.com
Wed Jan 3 21:34:00 GMT 2001


Jeff Sturm wrote:
> 
> On Wed, 3 Jan 2001, Cedric Berger wrote:
> > Yes, but it's been proven to be almost impossible to "written defensively"
> > this code. And there is a lot of such code. most of libgcj for example.
> > Is libgcj "written defensively" ?
> 
> Not sure what you mean.  But in our own code we do have many critical
> sections that perform some cleanup action.  Try...finally blocks work well
> for this.  (Note that the finally block is executed upon either
> InterruptedException or ThreadDeath, so hitting these with Thread.stop
> doesn't do any real harm.)
> 

try {
  sql.open()
  sql.use()
} finally {
  <<<--- For example here, A ThreadDeath() is thrown and abort the thing --->>>>
  <<<--- are you protected against that? --->>>>
  sql.close()
}


The problem of ThreadDeath is that he can appends anywhere,
anyplace, at any bytecode.

If the thread call, say "String.intern()" are you sure
that a ThreadDeath can come at any bytecode inside
String.intern() and leave the global structure intact?

If the thread call, say "new WeirdClass()" which trigger
classloading. Are you sure that a ThreadDeath() can occur
at any bytecode of the complex ClassLoading mechanism and
keep your VM intact?

Cedric


More information about the Java mailing list