--- old/src/share/vm/memory/metaspace.cpp 2016-03-21 17:57:38.000000000 +0300 +++ new/src/share/vm/memory/metaspace.cpp 2016-03-21 17:57:38.000000000 +0300 @@ -811,11 +811,6 @@ BlockFreelist::BlockFreelist() : _dictionary(new BlockTreeDictionary()) {} BlockFreelist::~BlockFreelist() { - LogHandle(gc, metaspace, freelist) log; - if (log.is_trace()) { - ResourceMark rm; - dictionary()->print_free_lists(log.trace_stream()); - } delete _dictionary; } @@ -2145,6 +2140,7 @@ // by the call to return_chunk_at_head(); Metachunk* next = cur->next(); DEBUG_ONLY(cur->set_is_tagged_free(true);) + NOT_PRODUCT(cur->mangle(badMetaWordVal);) list->return_chunk_at_head(cur); cur = next; } @@ -2169,11 +2165,9 @@ log.trace("~SpaceManager(): " PTR_FORMAT, p2i(this)); ResourceMark rm; locked_print_chunks_in_use_on(log.trace_stream()); + block_freelists()->print_on(log.trace_stream()); } - // Do not mangle freed Metachunks. The chunk size inside Metachunks - // is during the freeing of a VirtualSpaceNodes. - // Have to update before the chunks_in_use lists are emptied // below. chunk_manager()->inc_free_chunks_total(allocated_chunks_words(), @@ -2206,9 +2200,8 @@ Metachunk* humongous_chunks = chunks_in_use(HumongousIndex); while (humongous_chunks != NULL) { -#ifdef ASSERT - humongous_chunks->set_is_tagged_free(true); -#endif + DEBUG_ONLY(humongous_chunks->set_is_tagged_free(true);) + NOT_PRODUCT(humongous_chunks->mangle(badMetaWordVal);) log.trace(PTR_FORMAT " (" SIZE_FORMAT ") ", p2i(humongous_chunks), humongous_chunks->word_size()); assert(humongous_chunks->word_size() == (size_t) align_size_up(humongous_chunks->word_size(), @@ -2527,7 +2520,7 @@ for (Metachunk* curr = chunks_in_use(index); curr != NULL; curr = curr->next()) { - curr->mangle(); + curr->mangle(uninitMetaWordVal); } } }