-
Bug
-
Resolution: Fixed
-
P4
-
15
-
b06
See http://hg.openjdk.java.net/jdk/jdk/annotate/eee45238844e/src/hotspot/share/oops/instanceKlass.cpp#l2666
TempNewSymbol pkg_name = pkg_entry != NULL ? pkg_entry->name() : ClassLoader::package_from_class_name(name());
If pkg_entry->name() is stored into the TempNewSymbol, it's refcount is not incremented:
// Conversion from a Symbol* to a TempNewSymbol.
// Does not increment the current reference count.
TempNewSymbol(Symbol *s) : _temp(s) {}
but when the TempNewSymbol falls out of scope, we will call pkg_entry->name()->decrement_refcount():
~TempNewSymbol() {
if (_temp != NULL) {
_temp->decrement_refcount();
}
}
this causes the refcount of pkg_entry->name() to decrease by 1 when InstanceKlass::set_package returns.
This code was introduced inJDK-8240205 (there's a similar problem in systemDictionary.cpp). This has not caused any issue so far because we pkg_entry is non-NULL only for shared classes, whose package name is also a shared Symbol* with permanent refcount (-1), but logically this is incorrect and should be fixed to avoid future issues.
TempNewSymbol pkg_name = pkg_entry != NULL ? pkg_entry->name() : ClassLoader::package_from_class_name(name());
If pkg_entry->name() is stored into the TempNewSymbol, it's refcount is not incremented:
// Conversion from a Symbol* to a TempNewSymbol.
// Does not increment the current reference count.
TempNewSymbol(Symbol *s) : _temp(s) {}
but when the TempNewSymbol falls out of scope, we will call pkg_entry->name()->decrement_refcount():
~TempNewSymbol() {
if (_temp != NULL) {
_temp->decrement_refcount();
}
}
this causes the refcount of pkg_entry->name() to decrease by 1 when InstanceKlass::set_package returns.
This code was introduced in