--- a/hotspot/src/share/vm/classfile/classFileParser.cpp Tue Apr 08 11:50:01 2014 +0200
+++ b/hotspot/src/share/vm/classfile/classFileParser.cpp Tue Apr 08 13:58:38 2014 -0400
@@ -4180,8 +4180,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;
}