RFR (M) 8164921: Memory leaked when instrumentation.retransformClasses() is called repeatedly
serguei.spitsyn at oracle.com
serguei.spitsyn at oracle.com
Fri Sep 30 23:57:31 UTC 2016
Hi Coleen,
Just wanted to share a couple of comments I have so far.
http://cr.openjdk.java.net/~coleenp/8164921.01/webrev/src/share/vm/memory/metaspace.cpp.frames.html
302 debug_only(GrowableArray<Metablock*>* _all_blocks);
855 DEBUG_ONLY(_all_blocks = new (ResourceObj::C_HEAP, mtClass)
GrowableArray<Metablock*>(100, true)); 863 DEBUG_ONLY(delete
_all_blocks;) 891
DEBUG_ONLY(_all_blocks->remove((Metablock*)new_block)); 908
DEBUG_ONLY(_all_blocks->remove((Metablock*)free_block)); 922
DEBUG_ONLY(_all_blocks->remove((Metablock*)new_block));
Not clear, why different macros debug_only() is used at L302. Could
it be DEBUG_ONLY as well?
866 void BlockFreelist::return_block(MetaWord* p, size_t word_size) {
867 Metablock* free_chunk = ::new (p) Metablock(word_size);
868 if (word_size < SmallBlocks::small_block_min_size()) {
869 // Dark matter
870 return; 871 } else if (word_size <
SmallBlocks::small_block_max_size()) {
In case of dark matter the free_chunk is leaked. It is better to
rearrange the fragment to something like this:
void BlockFreelist::return_block(MetaWord* p, size_t word_size) {
if (word_size < SmallBlocks::small_block_min_size()) {
return; // Dark matter
}
Metablock* free_chunk = ::new (p) Metablock(word_size); if (word_size <
SmallBlocks::small_block_max_size()) {
886 MetaWord* BlockFreelist::get_block(size_t word_size) {
887 if (word_size < SmallBlocks::small_block_max_size() &&
small_blocks()->list_at(word_size).count() > 0) {
. . .
892 return new_block;
893 }
894
895 if (word_size < BlockFreelist::min_size()) {
896 // Dark matter. Too small for dictionary.
897 return NULL;
898 }
It'd be better to reorder the fragments 887-893 and 895-898. Thanks,
Serguei On 9/30/16 12:02, Coleen Phillimore wrote:
> Summary: Return Metablocks smaller than dictionary's dark matter. This
> change contributed by Jon Masamitsu and myself. To reclaim "dark
> matter" this change adds an array of small blocks by size, created
> lazily, to return Metablocks smaller than the BinaryTreeDictionary
> entry's minimum size. This change also fixed a bug in small object
> double free and adds debugging code to check for this case. With this
> change, the submitted test case runs indefinitely. Also passed rbt
> tier 1-5 testing. open webrev at
> http://cr.openjdk.java.net/~coleenp/8164921.01/webrev bug link
> https://bugs.openjdk.java.net/browse/JDK-8164921 Thanks, Coleen and Jon
More information about the hotspot-dev
mailing list