--- old/src/share/vm/memory/metaspace.cpp 2013-09-12 21:57:37.000000000 +0200 +++ new/src/share/vm/memory/metaspace.cpp 2013-09-12 21:57:37.000000000 +0200 @@ -2366,10 +2366,12 @@ grow_chunks_by_words, medium_chunk_bunch()); - if (TraceMetadataHumongousAllocation && - SpaceManager::is_humongous(next->word_size())) { - gclog_or_tty->print_cr(" new humongous chunk word size " PTR_FORMAT, - next->word_size()); + if (next != NULL) { + if (TraceMetadataHumongousAllocation && + SpaceManager::is_humongous(next->word_size())) { + gclog_or_tty->print_cr(" new humongous chunk word size " PTR_FORMAT, + next->word_size()); + } } return next; @@ -2487,9 +2489,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 +2496,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;