Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
126 views
in Technique[技术] by (71.8m points)

java - What can be done with 'PermGen out of space' exception in Tomcat-Spring-Hibernate web application?

We have an web application that uses Spring-Hibernate to persist registered users data in Oracle database. The application works fine in development environment, but when we copy it int live environment with much more data, it failed. Initially the application starts normally, but after few actions 'PermGen out of space' exception occured.

I've started to search in Google, Spring and Hibernate forums, but it doesn't help. There is many discussions about this error, but for each solution, there are people, that say: 'It works' and other people say 'It doesn't'.

For example, many people offer to increase -XX:MaxPermSize JVM parameter, other says that it doesn't works. There are posts that says that the problem in use of javassist library and others and cglib library needed to be used. Others says that the problem is in cglib.

We use Java1.5_0_09, Spring 2.5 with javaassist3.4.GA, Tomcat 5.5 as web-container and Oracle 10g as database.

Can anybody explain me what causes this problem and how to solve it?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The -XX:MaxPermSize does work, you've just got to get the right value. The default, I believe, is 32mb for t the client-mode VM, and 64mb for the server mode VM. I suggest setting it to 256mb, if you have the memory:

java -XX:MaxPermSize=256m

The problem occurs because Spring and Hibernate can make heavy use of runtime-generated classes, sometimes a lot of them. These generated classes all go into the PermGen memory pool, so if you use those frameworks, you often need to boost your PermGen to large amounts.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...