diff a/src/hotspot/share/gc/g1/g1ParScanThreadState.cpp b/src/hotspot/share/gc/g1/g1ParScanThreadState.cpp --- a/src/hotspot/share/gc/g1/g1ParScanThreadState.cpp +++ b/src/hotspot/share/gc/g1/g1ParScanThreadState.cpp @@ -66,13 +66,15 @@ { // We allocate number of young gen regions in the collection set plus one // entries, since entry 0 keeps track of surviving bytes for non-young regions. // We also add a few elements at the beginning and at the end in // an attempt to eliminate cache contention - size_t array_length = PADDING_ELEM_NUM + _surviving_words_length + PADDING_ELEM_NUM; + const size_t padding_elem_num = (DEFAULT_CACHE_LINE_SIZE / sizeof(size_t)); + size_t array_length = padding_elem_num + _surviving_words_length + padding_elem_num; + _surviving_young_words_base = NEW_C_HEAP_ARRAY(size_t, array_length, mtGC); - _surviving_young_words = _surviving_young_words_base + PADDING_ELEM_NUM; + _surviving_young_words = _surviving_young_words_base + padding_elem_num; memset(_surviving_young_words, 0, _surviving_words_length * sizeof(size_t)); _plab_allocator = new G1PLABAllocator(_g1h->allocator()); // The dest for Young is used when the objects are aged enough to