-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hello,
I have a memory leak issue when I deploy/undeploy my servlet.
I check with Jprofiler to detect where that come from.
To reproduce the issue very easly, I use a minimal web.xml and zk.xml, in the file web.xml there are only HttpSessionListener and DHtmlLayoutServlet, and the zk.xml file is empty.
After stopping my servlet, I saw lot of objects in memory from org.zkos.*, the classes HttpSessionListener and DHtmlLayoutServlet are correctly destroyed.
If I do that several time, I receive a permgen out of memory.
Is there another class to use to destroy the objects ?
can you provide your environment info ?
like zk version ,the class & package name ?
I have the same in Eclipse but it is caused by multiple project building without server restart (it appears if after i save project file few times eclipse build project itself without restarting server). So when im saving changes i restart server manually
PermGen-Errors on "redeploy without restart" are quite common, so I don't think that this is a ZK-"issue":
http://www.jroller.com/agileanswers/entry/preventing_java_s_java_lang
Best workaround seems to be to start Tomcat with higher PermGen-Space:
java ... -XX:MaxPermSize=256m
Update:
Here's another good hint... enable GC for Perm-Space (which is disabled by default and the root cause of these kind of errors):
http://community.eapps.com/showthread.php?p=326
Cheers, Maik
I haven't had time to bring this up myself... I agree that "PermGen-Errors on "redeploy without restart" are quite common" however I suspect that Zk contributes to the problem. They occur much more in my Zk app than non-Zk apps, and occur more when Zk jars in WEB-INF/lib vs Tomcat/lib. I think Zk loads lots if not all classes as part of startup configuration. I hit PermGen limit once and saw a bunch of messages about not being able to load classes referenced by lang-addon or whatever. Sorry, I'm in a hurry.
/Daryl
Because Java Classloader "WONT" release loaded classes, So hot deploy mechanism will consume your heap space every time it triggered.
(In SUN's JVM it surely cant release as I know, or can some one point out that I am wrong?)
I got the same configuration with mjablonski's post and this problem never bother me any more.
PS: DDR2 is too CHEAP, I could buy 2G in less then 16 USD which means it could be cheaper then my lunch!
What can I Say? God bless DRAM factories.
I've been using the PermGen GC settings specified above for a day or so now. It seems to delay the out of memory problem, but not by much. My catalina.sh has these lines:
CATALINA_OPTS="-Xms128m -Xmx768m -Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=8888,suspend=n -XX:+CMSPermGenSweepingEnabled -XX :+CMSClassUnloadingEnabled" JAVA_OPTS="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=4000 -Dcom.sun.management.jmxremote.authenticate=false -Dco m.\ sun.management.jmxremote.ssl=false"
WARNING: Component label ignored. Reason: unable to load org.zkoss.zul.Label due to java.lang.OutOfMemoryError: PermGen space [SYS jar:file:/Users/daryl/blah/blah/webapp/WEB-INF/lib/zul.jar!/metainfo/zk/lang.xml line 453 col 13]
I think this shows pretty clearly that Zk is loading classes before they are being used which seems like bad etiquette to me.
/Daryl
I don't see your permgen maximum setting in your CATALINA_OPTS, in SUN's JVM it should be looked like this:
-XX:MaxPermSize=200m
As I remembered, the default value is poorly low comparing how large RAM we have.
>I don't see your permgen maximum setting in your CATALINA_OPTS, in SUN's JVM it should be >looked like this:
-XX:MaxPermSize=200m
>As I remembered, the default value is poorly low comparing how large RAM we have.
Ok, I've set my MaxPermGen to 256m and it seems to be fine. No more permgen errors on my development machine. I guess it needed a little breathing room to do GC on PermGen. Next is the production configuration...
So my development settings are now:
CATALINA_OPTS="-Xms128m -Xmx768m -XX:MaxPermSize=256m -Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=8888,suspend=n" JAVA_OPTS="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=4000 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.\ sun.management.jmxremote.ssl=false -XX:+CMSPermGenSweepingEnabled -XX:+CMSClassUnloadingEnabled"
/Daryl
Asked: 2009-01-12 06:25:36 +0800
Seen: 1,830 times
Last updated: Feb 02 '09