JDK-8048086 : G1BlockOffsetSharedArray::compute_size() uses wrong alignment to calculate the amount of space to be reserved
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: 8u40,9
  • Priority: P4
  • Status: Closed
  • Resolution: Won't Fix
  • OS: windows
  • Submitted: 2014-06-25
  • Updated: 2017-01-18
  • Resolved: 2014-06-26
Related Reports
Relates :  
The BOT for G1 uses vm_page_size() to align the space required for the BOT offset table. This is wrong on Windows, as the reservations need to be aligned according to os::vm_allocation_granularity.

During development I observed crashes on Windows due to that.

The suggested fix is 

static size_t compute_size(size_t mem_region_words) {
  size_t number_of_slots = (mem_region_words / N_words);
-  return ReservedSpace::page_align_size_up(number_of_slots);
+  return ReservedSpace::allocation_align_size(number_of_slots);

This problem only occurs in new code where compute_size() is called in a different context. Without these changes the bug does not occur.