8011803: release_C_heap_structures is never called for anonymous classes

Call this function from the ClassLoaderData destructor instead of the system dictionary walk.

Reviewed-by: stefank, mgerdin
This commit is contained in:
Coleen Phillimore 2013-04-24 16:19:35 -04:00
parent d567edd809
commit cd7d504d54
4 changed files with 35 additions and 15 deletions

View file

@ -277,6 +277,9 @@ void ClassLoaderData::remove_class(Klass* scratch_class) {
void ClassLoaderData::unload() {
_unloading = true;
// Tell serviceability tools these classes are unloading
classes_do(InstanceKlass::notify_unload_class);
if (TraceClassLoaderData) {
ResourceMark rm;
tty->print("[ClassLoaderData: unload loader data "PTR_FORMAT, this);
@ -300,6 +303,9 @@ bool ClassLoaderData::is_alive(BoolObjectClosure* is_alive_closure) const {
ClassLoaderData::~ClassLoaderData() {
// Release C heap structures for all the classes.
classes_do(InstanceKlass::release_C_heap_structures);
Metaspace *m = _metaspace;
if (m != NULL) {
_metaspace = NULL;