Garbage Collector Issues on Win98/gcj 4.02

Mohan Embar gnustuff@thisiscool.com
Tue May 23 19:28:00 GMT 2006


Hi People,

I've been looking into this a bit:

http://gcc.gnu.org/ml/java/2006-05/msg00014.html

This is the little I'm seeing from the little time I've
had to look into this.

The first point of failure is here:

void
java::lang::Class::finalize (void)
{
  engine->unregister(this);
}

During the startup sequence, this is sometimes
called by Win98 to finalize arrays of classes
that were presumably termporary objects needed
for whatever bootstrapping is needed. (I'm just
guessing here, since I'm not really sure what's
going on.) In any case, when this method is
called "engine" is still null, so we choke here.

I (probably naively) changed the above to

if (engine) engine->unregister(this)

The next horrible thing that happens is in this
call in _Jv_NewStringUtf8Const (natString.cc):

_Jv_RegisterFinalizer ((void *) jstr, _Jv_FinalizeString);

This ends up calling GC_register_finalizer_inner in finalize.c,
and whatever it does ends up trashing the contents of strhash
(natString.cc).

I haven't looked into why this happens on Win98 and not WinXP.
Also, when I make GC_register_finalizer_inner return right away
without doing anything, the program dies later on for reasons
I can't quite understand.

Just wanted to throw this over the wall in case it rings a
bell with anyone.

-- Mohan Embar
http://www.thisiscool.com/
http://www.animalsong.org/






More information about the Java mailing list