diff src/share/vm/classfile/classFileParser.cpp @ 17883:9428a0b94204

8028497: SIGSEGV at ClassLoaderData::oops_do(OopClosure*, KlassClosure*, bool) Summary: Keep class in CLD::_klasses list and mirror created for CDS classes if OOM during restore_shareable_info(). This keeps pointers consistent for CMS. Reviewed-by: ehelin, stefank, jmasa, iklam
author coleenp
date Tue, 15 Apr 2014 17:02:20 -0400
parents 9acf9c25774d
children 7e6c20c85ccf
line wrap: on
line diff
--- a/src/share/vm/classfile/classFileParser.cpp	Thu Feb 13 10:05:03 2014 +0100
+++ b/src/share/vm/classfile/classFileParser.cpp	Tue Apr 15 17:02:20 2014 -0400
@@ -4170,8 +4170,12 @@
 
   clear_class_metadata();
 
-  // deallocate the klass if already created.
-  MetadataFactory::free_metadata(_loader_data, _klass);
+  // deallocate the klass if already created.  Don't directly deallocate, but add
+  // to the deallocate list so that the klass is removed from the CLD::_klasses list
+  // at a safepoint.
+  if (_klass != NULL) {
+    _loader_data->add_to_deallocate_list(_klass);
+  }
   _klass = NULL;
 }