Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

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

exception - 处理“ java.lang.OutOfMemoryError:PermGen空间”错误(Dealing with “java.lang.OutOfMemoryError: PermGen space” error)

Recently I ran into this error in my web application:

(最近,我在Web应用程序中遇到此错误:)

java.lang.OutOfMemoryError: PermGen space

(java.lang.OutOfMemoryError:PermGen空间)

It's a typical Hibernate/JPA + IceFaces/JSF application running on Tomcat 6 and JDK 1.6.

(这是在Tomcat 6和JDK 1.6上运行的典型Hibernate / JPA + IceFaces / JSF应用程序。)

Apparently this can occur after redeploying an application a few times.

(显然,这可能是在重新部署应用程序几次之后发生的。)

What causes it and what can be done to avoid it?

(是什么原因引起的,可以采取什么措施避免它发生?)

How do I fix the problem?

(我该如何解决该问题?)

  ask by community wiki translate from so

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

1 Reply

0 votes
by (71.8m points)

The solution was to add these flags to JVM command line when Tomcat is started:

(解决方案是在启动Tomcat时将这些标志添加到JVM命令行:)

-XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled

You can do that by shutting down the tomcat service, then going into the Tomcat/bin directory and running tomcat6w.exe.

(您可以通过关闭tomcat服务,然后进入Tomcat / bin目录并运行tomcat6w.exe来做到这一点。)

Under the "Java" tab, add the arguments to the "Java Options" box.

(在“ Java”选项卡下,将参数添加到“ Java选项”框中。)

Click "OK" and then restart the service.

(单击“确定”,然后重新启动服务。)

If you get an error the specified service does not exist as an installed service you should run:

(如果出现错误, 则指定的服务不存在为已安装的服务 ,应运行:)

tomcat6w //ES//servicename

where servicename is the name of the server as viewed in services.msc

(其中servicename是在services.msc中查看的服务器的名称)

Source: orx's comment on Eric's Agile Answers .

(资料来源:orx对Eric的《敏捷答案》的评论。)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...