changeset 5272:8227700da288

8024751: Fix bugs in TraceMetadata Reviewed-by: jmasa, brutisso
author stefank
date Fri, 13 Sep 2013 22:23:48 +0200
parents 9e11762cee52
children 8c5e6482cbfc
files src/share/vm/memory/metaspace.cpp
diffstat 1 files changed, 7 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/memory/metaspace.cpp	Fri Sep 13 22:22:14 2013 +0200
+++ b/src/share/vm/memory/metaspace.cpp	Fri Sep 13 22:23:48 2013 +0200
@@ -2366,10 +2366,10 @@
                                              grow_chunks_by_words,
                                              medium_chunk_bunch());
 
-  if (TraceMetadataHumongousAllocation &&
+  if (TraceMetadataHumongousAllocation && next != NULL &&
       SpaceManager::is_humongous(next->word_size())) {
-    gclog_or_tty->print_cr("  new humongous chunk word size " PTR_FORMAT,
-                           next->word_size());
+    gclog_or_tty->print_cr("  new humongous chunk word size "
+                           PTR_FORMAT, next->word_size());
   }
 
   return next;
@@ -2487,9 +2487,6 @@
          curr = curr->next()) {
       out->print("%d) ", i++);
       curr->print_on(out);
-      if (TraceMetadataChunkAllocation && Verbose) {
-        block_freelists()->print_on(out);
-      }
       curr_total += curr->word_size();
       used += curr->used_word_size();
       capacity += curr->capacity_word_size();
@@ -2497,6 +2494,10 @@
     }
   }
 
+  if (TraceMetadataChunkAllocation && Verbose) {
+    block_freelists()->print_on(out);
+  }
+
   size_t free = current_chunk() == NULL ? 0 : current_chunk()->free_word_size();
   // Free space isn't wasted.
   waste -= free;