When will G1 shrink the heap?

Yu Zhang yu.zhang at oracle.com
Tue Apr 12 18:03:47 UTC 2016


Paul,

I checked both jdk8 and current jdk9. The heap is only shrinked after 
full gc.
After full gc, there is a way to calculate maximum_desired_capacity 
(based on used heap after full gc and historic data). If the committed 
heap is bigger than the maximum_desired_capacity, then the heap shrinks.

If you -XX:+PrintAdaptiveSizePolicy, you should see messages in the gc 
log when shrinking happens.
"Attempt heap shrinking..."

Thanks,
Jenny

On 4/11/2016 11:24 AM, Paul Richards wrote:
> I try to track the latest stable release from Oracle.  Currently we're
> using Java SE 8u77.
>
> I will likely migrate to Java 9 when it is officially released, so it
> would be interesting to know if your answer is different for Java 9.
>
> On 11 April 2016 at 18:20, Yu Zhang <yu.zhang at oracle.com> wrote:
>> Paul,
>>
>> Which jdk version are you using?
>>
>> Thanks,
>> Jenny
>>
>> On 4/6/2016 6:13 AM, Paul Richards wrote:
>>
>> Hi there,
>> Under what circumstances will G1 decide to shrink the heap?  I'm
>> hoping someone can point me to existing docs for this.
>>
>>
>>
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/hotspot-gc-use/attachments/20160412/564f90a6/attachment.html>


More information about the hotspot-gc-use mailing list