JDK-8154838 : G1CardLiveData::free_large_bitmap() uses wrong calculation to determine the number of words
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: 9
  • Priority: P5
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2016-04-21
  • Updated: 2016-05-26
  • Resolved: 2016-04-22
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9 b120Fixed
Related Reports
Relates :  
Description
G1CardLiveData::bm_word_t* G1CardLiveData::allocate_large_bitmap(size_t size_in_bits) {
  size_t size_in_words = BitMap::calc_size_in_words(size_in_bits);

  bm_word_t* map = MmapArrayAllocator<bm_word_t, mtGC>::allocate(size_in_words);

  return map;
}

void G1CardLiveData::free_large_bitmap(bm_word_t* bitmap, size_t size_in_bits) {
  MmapArrayAllocator<bm_word_t, mtGC>::free(bitmap, size_in_bits / BitsPerWord);
}

The calculation of the number of elements in free_large_bitmap() is different to the one of allocate_large_bitmap().

The calculation itself is correct, as size_in_bits is always word aligned for all callers.