// Create a symbol and update the anonymous class name.
_class_name = SymbolTable::new_symbol(new_anon_name,
(int)host_pkg_len + 1 + class_name_len,
CHECK);
This needs to decrement the refcount of the thing that was in _class_name. But that leads to the problem that the Symbol in class_name is incremented again in fill_instance_klass() -> set_name(). Ie the owner of the _class_name is not decremented when ~ClassFileParser is called. _class_name should have an increment_refcount in the constructor.
IE. wherever Symbol* are stored, they need an increment refcount.
Thanks to [~kbarrett] for finding this.
_class_name = SymbolTable::new_symbol(new_anon_name,
(int)host_pkg_len + 1 + class_name_len,
CHECK);
This needs to decrement the refcount of the thing that was in _class_name. But that leads to the problem that the Symbol in class_name is incremented again in fill_instance_klass() -> set_name(). Ie the owner of the _class_name is not decremented when ~ClassFileParser is called. _class_name should have an increment_refcount in the constructor.
IE. wherever Symbol* are stored, they need an increment refcount.
Thanks to [~kbarrett] for finding this.
- relates to
-
JDK-8218755 Refix Symbol leak in prepend_host_package_name
- Resolved