I some time get
Java heap error and permgen error in my project which is having large code base i.e 2500 java lasses.
I know about two jvm parameter which we can set to deal with for java heap we can -Xms 1024 -Xmx 1024 and for permgen we can set -Xmx:permgen 256m.
That also sometime does not solve the problem. I am looking forward if we can do something proactively while programming the application so that we can descrease the probablity of facing such issues. here is my understanding
Permgen error can occur either at serverstart up or at application run time. I can think two main reason for this:
1) More the classes will be loaded more spaces will be eaten in permgen area.
2) Too many reference of static variable in application (as they gets also stored in permgen area). Agreed it wont make much difference. Probably millions of variable can make difference.
3)Too many
string literals used in application.
So while programming we can take care of points 2 and 3 if we can avoid them. Looking for some other solutions also which we can keep in mind while programming to avoid these situations(For both permgen and java heap out of memory issue). Could not come up if we can follow any proactive approach for not facing java heap out of memory issue?
posted at
https://forums.oracle.com/forums/thread.jspa?threadID=2281919&tstart=0 too but did not get comprehensive reply?