Free ratio based heap shrinking in the parallel collector

Jon Masamitsu jon.masamitsu at
Thu Apr 1 09:02:44 PDT 2010

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 
a small heap to MinFreeHeapRatio?  UseAdaptiveSizePolicy will shrink the 
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 

 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