Free ratio based heap shrinking in the parallel collector

Hiroshi Yamauchi yamauchi at
Tue Apr 13 11:21:11 PDT 2010

Hi Jon,

I finally got to this. Here's the webrev for a second version based on
our discussion (thanks to Chuck Rasbold):

The summary of change is that the logic for expansion based on
MinHeapFreeRatio was added and only the flag for the System.gc was
retained (and renamed to PSResizeByFreeRatioWithSystemGC.)


On Thu, Apr 1, 2010 at 9:02 AM, Jon Masamitsu <jon.masamitsu at> wrote:
> On 03/31/10 11:26, Hiroshi Yamauchi wrote:
>> ...
>> I think we agree that it's a good idea to try to shrink the heap in
>> response to System.gc() in such a scenario/app.
> Yes on the shrinking on a System.gc() and perhaps for symmetry also
> expanding
> a small heap to MinFreeHeapRatio?  UseAdaptiveSizePolicy will shrink the
> heap
> down during periods of low activity and it might be useful to swiftly expand
> the
> heap on a System.gc().
>> Since we are talking about a setting where the free ratio flags takes
>> precedence over the psAdaptiveSizePolicy's throughput goals, the suggested
>> logic in the original webrev is perhaps not so terrible? If so, I suppose
>> the logic for UseFreeRatioOnlyInSystemGCForParallelGC does help with that
>> because it can shrink the heap regardless of the throughput goal. It may
>> make sense to remove UseFreeRatioForParallelGC and keep
>> UseFreeRatioOnlyInSystemGCForParallelGC only. If you'd like to see it happen
>> inside psAdaptiveSizePolicy instead, the current webrev does not work.
> I like the structure of the original webrev with regard to the logic for
> using FreeRation.  It's simpler than embedding it in the
> PSAdaptivesizePolicy.
> 243     if (UseFreeRatioOnlyInSystemGCForParallelGC &&
> 245           gc_cause == GCCause::_java_lang_system_gc)) {
>          compute_new_size();  <<<<<<<<  generalization of
>              <<<<<<<<  try_to_shrink_by_free_ratio()
> 248     } else {
>          use current UseAdaptiveSizePolicy
>        }

More information about the hotspot-gc-dev mailing list