When will G1 shrink the heap?

Yu Zhang yu.zhang at oracle.com
Tue Apr 12 20:06:58 UTC 2016


Paul,

On 4/12/2016 11:54 AM, Paul Richards wrote:
>
> My understanding is that under normal circumstances G1 should only 
> perform young and mixed GC cycles.  A full GC should be a rare 
> occurrence from what I read.
>
Yes, for G1 we should try to avoid full gc.
>
> Combined with the information you've kindly provided, does this mean 
> that G1 will practically never shrink the heap if the system is 
> running healthily?
>
That is the case for now. This might change in the future.
>
> Thanks,
>
>
> On Tue, 12 Apr 2016 19:03 Yu Zhang, <yu.zhang at oracle.com 
> <mailto:yu.zhang at oracle.com>> wrote:
>
>     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> <mailto: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/f80fc44d/attachment.html>


More information about the hotspot-gc-use mailing list