diff src/share/vm/memory/metadataFactory.hpp @ 12857:d37a0525c0fe

8024667: VM crashes with "assert(method() != NULL) failed: must have set method" Summary: Check if data is in shared spaces before deallocating it. Reviewed-by: coleenp, dcubed
author hseigel
date Sat, 12 Oct 2013 15:39:16 -0400
parents 59a58e20dc60
children 2c6ef90f030a
line wrap: on
line diff
--- a/src/share/vm/memory/metadataFactory.hpp	Sat Oct 12 13:09:18 2013 -0400
+++ b/src/share/vm/memory/metadataFactory.hpp	Sat Oct 12 15:39:16 2013 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -65,6 +65,7 @@
   static void free_array(ClassLoaderData* loader_data, Array<T>* data) {
     if (data != NULL) {
       assert(loader_data != NULL, "shouldn't pass null");
+      assert(!data->is_shared(), "cannot deallocate array in shared spaces");
       int size = data->size();
       if (DumpSharedSpaces) {
         loader_data->ro_metaspace()->deallocate((MetaWord*)data, size, false);
@@ -83,6 +84,7 @@
       // Call metadata's deallocate function which will call deallocate fields
       assert(!DumpSharedSpaces, "cannot deallocate metadata when dumping CDS archive");
       assert(!md->on_stack(), "can't deallocate things on stack");
+      assert(!md->is_shared(), "cannot deallocate if in shared spaces");
       md->deallocate_contents(loader_data);
       loader_data->metaspace_non_null()->deallocate((MetaWord*)md, size, md->is_klass());
     }