## src/share/vm/memory/collectorPolicy.cpp

Print this page

*** 444,465 ****
_min_gen0_size = max_new_size;
_initial_gen0_size = max_new_size;
_max_gen0_size = max_new_size;
} else {
size_t desired_new_size = 0;
! if (!FLAG_IS_DEFAULT(NewSize)) {
! // If NewSize is set ergonomically (for example by cms), it
! // would make sense to use it. If it is used, also use it
! // to set the initial size. Although there is no reason
! // the minimum size and the initial size have to be the same,
! // the current implementation gets into trouble during the calculation
! // of the tenured generation sizes if they are different.
! // Note that this makes the initial size and the minimum size
! // generally small compared to the NewRatio calculation.
_min_gen0_size = NewSize;
desired_new_size = NewSize;
max_new_size = MAX2(max_new_size, NewSize);
} else {
// For the case where NewSize is the default, use NewRatio
// to size the minimum and initial generation sizes.
// Use the default NewSize as the floor for these values. If
// NewRatio is overly large, the resulting sizes can be too small.
--- 444,467 ----
_min_gen0_size = max_new_size;
_initial_gen0_size = max_new_size;
_max_gen0_size = max_new_size;
} else {
size_t desired_new_size = 0;
! if (FLAG_IS_CMDLINE(NewSize)) {
! // If NewSize is set on the command line, we must use it as
! // the initial size and it also makes sense to use it as the
! // lower limit.
_min_gen0_size = NewSize;
desired_new_size = NewSize;
max_new_size = MAX2(max_new_size, NewSize);
+ } else if (FLAG_IS_ERGO(NewSize)) {
+ // If NewSize is set ergonomically, we should use it as a lower
+ // limit, but use NewRatio to calculate the initial size.
+ _min_gen0_size = NewSize;
+ desired_new_size =
+ MAX2(scale_by_NewRatio_aligned(_initial_heap_byte_size), NewSize);
+ max_new_size = MAX2(max_new_size, NewSize);
} else {
// For the case where NewSize is the default, use NewRatio
// to size the minimum and initial generation sizes.
// Use the default NewSize as the floor for these values. If
// NewRatio is overly large, the resulting sizes can be too small.