MinHeapFreeRatio / MaxHeapFreeRatio

Damon Hart-Davis dhd at exnet.com
Thu May 10 10:49:56 PDT 2012


Hi,

I's be happy if the JVM gave memory back to the OS either following a STW triggered by System.gc() or a CMS failure, or opportunistically in the normal course of GC at least to the extent that trailing live objects would constrain it.  The latter would presumably be slightly less toxic in terms of fruitless pauses, etc, if it could be done.

Rgds

Damon



On 10 May 2012, at 18:35, Jon Masamitsu wrote:

> 
> 
> On 5/10/2012 9:41 AM, Krystal Mok wrote:
>> Hi Jon,
>> 
>> No, CMS doesn't do shrinking at all. The interface is there in the
>> generational GC framework, but the implementation in CMS is left empty. I
>> tried to implement shrinking in CMS once, but I ran out of time completing
>> it, and found out that the original demand from our internal customer was
>> supposed to be using ParallelGC, so I gave up.
>> 
>> Resizing generations to meet MinHeapFreeRatio / MaxHeapFreeRatio means
>> shrinking has to be implemented in CMS, right?
> 
> Not quite.   Damon was using System.gc() to try to resize and 
> System.gc() (not using the concurrent
> collection but the STW collection) uses the MarkSweep code.  That code 
> can use the compute_new_size()
> and shrink the heap.
> 
> You're right about the CompactibleFreeListSpace used by CMS where the 
> free space is on
> a free list.  Live objects at the end of the generation make it 
> impossible to shrink the
> generation.
> 
> Jon
>> - Kris
>> 
>> On Fri, May 11, 2012 at 12:31 AM, Jon Masamitsu<jon.masamitsu at oracle.com>wrote:
>> 
>>> Damon,
>>> 
>>>  From inspection of the code I think that CMS does not do a
>>> resizing of the heap after it does a System.gc().  That resizing
>>> would be the code that adjusts the generations for
>>> MinHeapFreeRatio / MaxHeapFreeRatio and returns
>>> memory to the OS.
>>> 
>>> I've created CR 7167923 to investigate this bug.
>>> 
>>> Jon
>>> 
>>> On 5/9/2012 2:34 AM, Damon Hart-Davis wrote:
>>>> Hi,
>>>> 
>>>> No, because when I explicitly call System.gc() I want it to try as hard
>>> as it can, even to the point of stopping the world...
>>>> Rgds
>>>> 
>>>> Damon
>>>> 
>>>> 
>>>> On 9 May 2012, at 10:27, Jon Masamitsu wrote:
>>>> 
>>>>> Damon,
>>>>> 
>>>>> Do you turn on ExplicitGCInvokesConcurrent?
>>>>> 
>>>>> Jon
>>>>> 
>>> _______________________________________________
>>> hotspot-gc-use mailing list
>>> hotspot-gc-use at openjdk.java.net
>>> http://mail.openjdk.java.net/mailman/listinfo/hotspot-gc-use
>>> 
> _______________________________________________
> hotspot-gc-use mailing list
> hotspot-gc-use at openjdk.java.net
> http://mail.openjdk.java.net/mailman/listinfo/hotspot-gc-use
> 



More information about the hotspot-gc-use mailing list