1

I want to clear PermGen memory in tomcat without restarting tomcat.
How can do this activity? I get:

PermGen: OutOfMemoryError

My problem is that I don't want to shut down tomcat.

Green
  • 2,405
  • 3
  • 22
  • 46
ErenSalman
  • 13
  • 3
  • 1
    I'm not sure this is even possible (or at least not easy). This problem already exists for quite a while and if it were easy to solve without a restart it probably would be part of Tomcat - at least in the form of some documentation. – Thomas Nov 22 '18 at 14:52
  • I would say why and you should not instead fix the root cause. Increase the heap settings and then see if that helps. Check this thread https://stackoverflow.com/questions/10085028/what-to-do-with-tomcat-permgen-space – Sheetal Mohan Sharma Nov 22 '18 at 15:25
  • My main purpose is to do deployment with downtime zero. When i searched this topic, i found "paralel deployment" in tomcat. But after a while tomcat's memory (also permGen) is increased. Because i do not restart during deployment. So i want to find a way to stop or clear increased memory. – ErenSalman Nov 22 '18 at 15:27
  • Which Tomcat version are you using ? If old, maybe it's necessary to upgrade since some issues were corrected that could help you. – Eugène Adell Nov 22 '18 at 15:33
  • I am using apache-tomcat-7.0.73. – ErenSalman Nov 22 '18 at 15:39
  • 1
    When you undeploy the old version of your app, do you get warnings about potential leak issues? On successful full undeployment of an app tomcat should be able to garbage collect that apps' WebAppClassLoader and thus free the permgen from classes. If there is a Thread or ThreadLocale left on your app, undeployment won't fully succeed and your permGen will fill which each start/stop of your app. – Selaron Nov 22 '18 at 15:50
  • @Selaron +1 for the warning. There are some memory leaks corrected since 7.0.73, an upgrade is worth trying. – Eugène Adell Nov 22 '18 at 15:56
  • I found "-XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled" these flags for prevent the increased permGen space. What do you think about these flag? Is ıt solved the problem? @Selaron – ErenSalman Nov 22 '18 at 16:48

0 Answers0