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 diff a/src/hotspot/share/gc/g1/g1ParScanThreadState.hpp b/src/hotspot/share/gc/g1/g1ParScanThreadState.hpp --- a/src/hotspot/share/gc/g1/g1ParScanThreadState.hpp +++ b/src/hotspot/share/gc/g1/g1ParScanThreadState.hpp @@ -79,12 +79,10 @@ size_t _surviving_words_length; // Indicates whether in the last generation (old) there is no more space // available for allocation. bool _old_gen_is_full; -#define PADDING_ELEM_NUM (DEFAULT_CACHE_LINE_SIZE / sizeof(size_t)) - G1RedirtyCardsQueue& redirty_cards_queue() { return _rdcq; } G1CardTable* ct() { return _ct; } G1HeapRegionAttr dest(G1HeapRegionAttr original) const { assert(original.is_valid(),