# GCOverheadLimit does not work ?

Jon Masamitsu Jon.Masamitsu at Sun.COM
Mon Jun 9 18:55:07 UTC 2008

```
David Tavoularis wrote:
> Hi Jon,
>
> I would like to understand the computation of the percentage for the following Full GC example :
>
> 57587.994: [Full GC [PSYoungGen: 262144K->260978K(317184K)] [PSOldGen: 1310719K->1310719K(1310720K)] 1572863K->1571698K(1627904K) [PSPermGen: 17242K->17242K(20480K)]
> Heap after GC :
> PSYoungGen      total 317184K, used 260978K (eden=262144K, from=OK (out of 55040K))
> PSOldGen        total 1310720K, used 1310719K
> PSPermGen       total 20480K, used 17242K
>
> So the percentage is computed like this : ((317184K-260978K)+(1310720K-1310719K)+(20480K-17242K))/(317184K+1310720K+20480K)=59445K/1648384K=3.6% > 2%
>

If you want a definitive answer, please take a look at the sources.
As I recall it, the perm gen is not counted so it's more like

((317184K-260978K)+(1310720K-1310719K)) / (317184K+1310720K) = 3.5%

> The fix would be to compute it like this : ((262144K-260978K)+(1310720K-1310719K)+(20480K-17242K))/(317184K+1310720K+20480K)=4405K/1648384K=0.3% < 2%
>

I don't think that is always the right answer.  If the survivor space is
being used (i.e., objects are copied to it and collected from it), then
it should be counted.  In a young gen collection I would expect it to
be counted all the time but there might be exceptions (e.g., an always
tenure policy).  When it's a full collection if it was being used
it should be counted.  I would expect it to be used when there are
young gen collections occurring between full collections.  If the
collections are back-to-back full collections and the survivor space
is not being used it might make sense to not count it.  Sorry, it's
just not clear to me.  Counting it sometimes and not counting it
others might surprise some users.

>
>
> Is there a WA to this issue ?

WA?

>
> 1. Is is possible to change by property the percentage from 2% to 5% ?

-XX:GCHeapFreeLimit=5

>
> 2. Maybe I could reduce the young size from 256MB to 128MB, and it will automatically reduce (?) the survivor from 55040K to 27520K ? And the percentage would be in this case 1.9% and the OOM would be triggered.
>

That might work but what is your goal?  This feature is to just