0

Environment Profile:

  • Tomcat: 7
  • Java: 1.6
  • IDE: Eclipse Juno
  • OS: Windows 7 - 64bit

I'm getting the following PermGen exception when I have 2 Web Apps on the same Tomcat:

java.lang.OutOfMemoryError: PermGen space

Tomcat deploys fine without any errors however as soon as I try to access either of the Web Apps in the browser I get a PermGen space exception.

However if I deploy only 1 Web App on the Tomcat then everything seems fine.

I have tried increasing my PermGen size on the Tomcat config however I still get this exception.

Any ideas?

Harvey Sembhi
  • 287
  • 1
  • 5
  • 13
  • Let's see the actual option you set to increase the PermGen size, and how much memory did you give it? I see one post that warns of a difference between -XX:MaxPermSize=128M and -XX:MaxPermGen=128M where the first one is preferred. As another option, you could obviously have two tomcat servers on the same machine with different ports. – sdanzig Oct 27 '13 at 16:48
  • Hi, Thanks for your response! Here is my PermGen setting: set JAVA_OPTS="-Xms1024m -Xmx10246m -XX:NewSize=512m -XX:MaxNewSize=1024m -XX:PermSize=512m -XX:MaxPermSize=1024m" – Harvey Sembhi Oct 27 '13 at 17:56
  • So you were increasing that MaxPermSize? I'd check to make sure your tomcat wasn't being run with command-line options that could override your JAVA_OPTS setting. – sdanzig Oct 27 '13 at 18:18
  • Yes I increased the PermMaxSize after reading various forums and tutorials however I'm still getting the exception. Initially it was set to 256m. – Harvey Sembhi Oct 27 '13 at 18:20
  • Where do you set the JAVA_OPTS? These values should be enough, so it is probably not using them. – David Levesque Oct 27 '13 at 22:38
  • Also I just noticed that you seem to have an extra "6" in `-Xmx10246m`, so maybe Tomcat is ignoring them because it seems excessive. – David Levesque Oct 27 '13 at 22:40
  • I set the values in the 'catalina.bat' file however I thing this is being overridden by Eclipse as when I put the PermGen parameters as VM arguments within the Tomcat config in Eclipse, I can see the difference in JProfiler. This fixed the issue, in fact 256mb was more then enough however my Hosting provider is only allowing me to increase my PermGen size to 128mb! What can I do to my apps to help lower PermGen memory usage? According to JProfiler WebApp_A takes up approx 62mb and WebApp_B takes up approx 71mb which exceeds the 128mb limit and so I get a PermGen exception. – Harvey Sembhi Oct 28 '13 at 10:35
  • Also, both WebApps are built on the Spring + Hibernate frameworks... I also use Dozer, ORM, Spring Security, AOP and most of my settings and config is done through Spring config and properties files. JProfiler shows no signs of thread locks or increased memory consumption when deploying both WebApps onto the same Tomcat however as soon as I try to it one of the WebApps I get a PermGen exception! – Harvey Sembhi Oct 28 '13 at 10:53
  • The PermGen space is used to store class definitions, so minimizing the number of 3rd party libraries used could help. But 128m is a bit small by today's standards, so I would rater consider switching to a hosting provider allowing more than 128m. – David Levesque Oct 28 '13 at 15:29
  • @HarveySembhi :Were you able to solve this problem,because were are also facing the same issue. – Deb Feb 15 '17 at 05:55

0 Answers0