GC problem

Anthony Green green@redhat.com
Fri Jul 9 08:15:00 GMT 2004


I've hit what looks like a GC problem while loading many classes with
the interpreter.
In scanning over the code, I think I've found the problem. My fear is
that there's a window of opportunity for data in the constant pool to
get collected while preparing interpreted classes. 
An important array is allocated in _Jv_ClassReader::handleConstantPool:
 // the pool is scanned explicitly by the collector
 jbyte *pool_tags = (jbyte*) _Jv_AllocBytes (pool_count);
 _Jv_word *pool_data
 = (_Jv_word*) _Jv_AllocBytes (pool_count * sizeof (_Jv_word));
It gets assigned to _Jv_ClassReader::def for a while, and then
eventually stuffed into a proper class object, with the the GC header
and vtable that would enable correct explicit scanning. 
It seems that I've triggered a GC run between these two events, and
elements in my array are getting collected. In particular, UTF8 objects
allocated like so are being written over...
 pool_data[index].utf8 = _Jv_makeUtf8Const (buffer, len);
Does this make sense?
AG
-- 
Anthony Green <green@redhat.com>
Red Hat, Inc.


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /