mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 22:34:27 +02:00
8243503: InstanceKlass::_array_name is not needed and leaks
Decrement the refcount for all Klass in class unloading. Reviewed-by: lfoltan, hseigel
This commit is contained in:
parent
05bf8dced5
commit
f8ab03fa04
6 changed files with 30 additions and 45 deletions
|
@ -587,9 +587,9 @@ void InstanceKlass::deallocate_contents(ClassLoaderData* loader_data) {
|
|||
// to deallocate.
|
||||
assert(array_klasses() == NULL, "array classes shouldn't be created for this class yet");
|
||||
|
||||
// Release C heap allocated data that this might point to, which includes
|
||||
// Release C heap allocated data that this points to, which includes
|
||||
// reference counting symbol names.
|
||||
release_C_heap_structures();
|
||||
release_C_heap_structures_internal();
|
||||
|
||||
deallocate_methods(loader_data, methods());
|
||||
set_methods(NULL);
|
||||
|
@ -2386,7 +2386,6 @@ void InstanceKlass::metaspace_pointers_do(MetaspaceClosure* it) {
|
|||
it->push((Klass**)&_array_klasses);
|
||||
it->push(&_constants);
|
||||
it->push(&_inner_classes);
|
||||
it->push(&_array_name);
|
||||
#if INCLUDE_JVMTI
|
||||
it->push(&_previous_versions);
|
||||
#endif
|
||||
|
@ -2581,17 +2580,19 @@ static void method_release_C_heap_structures(Method* m) {
|
|||
m->release_C_heap_structures();
|
||||
}
|
||||
|
||||
void InstanceKlass::release_C_heap_structures(InstanceKlass* ik) {
|
||||
void InstanceKlass::release_C_heap_structures() {
|
||||
|
||||
// Clean up C heap
|
||||
ik->release_C_heap_structures();
|
||||
ik->constants()->release_C_heap_structures();
|
||||
release_C_heap_structures_internal();
|
||||
constants()->release_C_heap_structures();
|
||||
|
||||
// Deallocate and call destructors for MDO mutexes
|
||||
ik->methods_do(method_release_C_heap_structures);
|
||||
|
||||
methods_do(method_release_C_heap_structures);
|
||||
}
|
||||
|
||||
void InstanceKlass::release_C_heap_structures() {
|
||||
void InstanceKlass::release_C_heap_structures_internal() {
|
||||
Klass::release_C_heap_structures();
|
||||
|
||||
// Can't release the constant pool here because the constant pool can be
|
||||
// deallocated separately from the InstanceKlass for default methods and
|
||||
// redefine classes.
|
||||
|
@ -2629,12 +2630,6 @@ void InstanceKlass::release_C_heap_structures() {
|
|||
}
|
||||
#endif
|
||||
|
||||
// Decrement symbol reference counts associated with the unloaded class.
|
||||
if (_name != NULL) _name->decrement_refcount();
|
||||
|
||||
// unreference array name derived from this class name (arrays of an unloaded
|
||||
// class can't be referenced anymore).
|
||||
if (_array_name != NULL) _array_name->decrement_refcount();
|
||||
FREE_C_HEAP_ARRAY(char, _source_debug_extension);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue