src/share/vm/memory/universe.cpp
Print this page
@@ -874,16 +874,17 @@
}
// Reserve the Java heap, which is now the same for all GCs.
ReservedSpace Universe::reserve_heap(size_t heap_size, size_t alignment) {
+ assert(alignment <= Arguments::max_heap_alignment(), "actual alignment must be within maximum heap alignment");
// Add in the class metaspace area so the classes in the headers can
// be compressed the same as instances.
// Need to round class space size up because it's below the heap and
// the actual alignment depends on its size.
Universe::set_class_metaspace_size(align_size_up(ClassMetaspaceSize, alignment));
- size_t total_reserved = align_size_up(heap_size + Universe::class_metaspace_size(), alignment);
+ size_t total_reserved = align_size_up(heap_size, alignment) + Universe::class_metaspace_size();
assert(!UseCompressedOops || (total_reserved <= (OopEncodingHeapMax - os::vm_page_size())),
"heap size is too big for compressed oops");
char* addr = Universe::preferred_heap_base(total_reserved, Universe::UnscaledNarrowOop);
ReservedHeapSpace total_rs(total_reserved, alignment, UseLargePages, addr);