changeset 24018:001e0c530e2c

8158373: SIGSEGV: Metadata::mark_on_stack Summary: MetadataOnStackMark must be done before calling free_deallocate_list(). Reviewed-by: coleenp, sspitsyn
author shshahma
date Wed, 22 Jun 2016 13:46:47 +0000
parents 9f2a972df4da
children 6021c95f5944
files src/share/vm/classfile/classLoaderData.cpp
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/classfile/classLoaderData.cpp	Tue Apr 26 23:29:51 2016 +0530
+++ b/src/share/vm/classfile/classLoaderData.cpp	Wed Jun 22 13:46:47 2016 +0000
@@ -318,10 +318,6 @@
     }
     tty->print_cr("]");
   }
-
-  // In some rare cases items added to this list will not be freed elsewhere.
-  // To keep it simple, just free everything in it here.
-  free_deallocate_list();
 }
 
 oop ClassLoaderData::keep_alive_object() const {
@@ -817,6 +813,12 @@
     // called on all alive classes. See the comment in ClassLoaderDataGraph::clean_metaspaces.
     cld->free_deallocate_list();
   }
+
+  // In some rare cases items added to the unloading list will not be freed elsewhere.
+  // To keep it simple, walk the _unloading list also.
+  for (ClassLoaderData* cld = _unloading; cld != _saved_unloading; cld = cld->next()) {
+    cld->free_deallocate_list();
+  }
 }
 
 // CDS support