--- old/src/share/vm/opto/matcher.cpp 2015-09-14 15:54:43.189892890 +0200 +++ new/src/share/vm/opto/matcher.cpp 2015-09-14 15:54:43.009892881 +0200 @@ -2022,7 +2022,7 @@ // Set bits if Node is shared or otherwise a root void Matcher::find_shared( Node *n ) { // Allocate stack of size C->unique() * 2 to avoid frequent realloc - MStack mstack(C->unique() * 2); + MStack mstack(C->live_nodes() * 2); // Mark nodes as address_visited if they are inputs to an address expression VectorSet address_visited(Thread::current()->resource_area()); mstack.push(n, Visit); // Don't need to pre-visit root node