Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java HotSpot 1.6 VM, Garbage Collection - Scary PermGen

My app shows rising 'Old Generation'/'Tenured Generation' size, and when this reaches the max limit for 'Old Gen', then suddenly PermGen size increases. Here are my generation sizings:

-Xmx1200m -Xms1200m -Xmn450m -XX:MaxPermSize=600m -XX:+UseParallelGC

This is on 32 bit Fedora so can't have a bigger heap than this.

The app is not doing any fancy classloading, though it is using Spring IOC and Hibernate, the Spring App-context.xml defines some 1000 Beans.

This app starts with 175MB PermGen, which steadily increases to ~250MB in few hrs, stays that way till Tenured Generation reached ~780 MB, then permgen jumps to ~500MB while Old Gen drops to ~500MB.

This forces me to restart the App on daily basis, and gives me real scare of looming OutOfMemory Error.. Any insights would be very helpful.

Thanks Gala101

13/May: Could someone please throw light on what happens when 'Old Gen' is garbage collected?
Does the jvm put collections from 'Old Gen' into PermGen?
My PermGen spike comes only when collection happens from 'Old Gen', also decrease in OldGen size closely matches increase in PermGen size.
PS: I don't do any live deploy/undeploy as that's sure to eat up PermGen.
Below is a current spanshot from my monitoring page: (the committed part had just jumped from ~250 MB to 500 MB)

    PS Perm Gen
Type    Non-heap memory
Usage   init = 16777216(16384K) used = 254453736(248489K) committed = 504954880(493120K) max = 629145600(614400K)
Peak Usage  init = 16777216(16384K) used = 254453736(248489K) committed = 504954880(493120K) max = 629145600(614400K)
Collection Usage    init = 16777216(16384K) used = 252421536(246505K) committed = 504954880(493120K) max = 629145600(614400K)
like image 363
Gala101 Avatar asked May 11 '10 10:05

Gala101


1 Answers

I would follow leonm's advice to analyze what takes so much memory. I bet you have some kind of nasty memory leak.

You say you don't do any fancy classloading, but Hibernate generates some classes on the fly for you. Do you use some AOP features (e.g. from Spring AOP module?).

Basically, if you are running out of PermGen space, then it seems like your application keeps on producing new classes (because it's classes which are stored in PermGen).

like image 67
Grzegorz Oledzki Avatar answered Sep 21 '22 13:09

Grzegorz Oledzki