8292318: Memory corruption in remove_dumptime_info

Reviewed-by: coleenp, ccheung
This commit is contained in:
Ioi Lam 2022-08-22 03:43:27 +00:00
parent 9a65524e2f
commit 27b0f7726b
7 changed files with 39 additions and 85 deletions

View file

@ -576,8 +576,6 @@ void InstanceKlass::deallocate_record_components(ClassLoaderData* loader_data,
// This function deallocates the metadata and C heap pointers that the
// InstanceKlass points to.
void InstanceKlass::deallocate_contents(ClassLoaderData* loader_data) {
SystemDictionaryShared::handle_class_unloading(this);
// Orphan the mirror first, CMS thinks it's still live.
if (java_mirror() != NULL) {
java_lang_Class::set_klass(java_mirror(), NULL);
@ -692,6 +690,8 @@ void InstanceKlass::deallocate_contents(ClassLoaderData* loader_data) {
MetadataFactory::free_metadata(loader_data, annotations());
}
set_annotations(NULL);
SystemDictionaryShared::handle_class_unloading(this);
}
bool InstanceKlass::is_record() const {