2013-02-19 27 views
0

我正在開發一個使用java的應用程序,我正在使用GlassFish服務3+作爲我的容器,有時候當我運行我的應用程序運行到以下錯誤時,我不知道會是什麼原因,爲什麼我收到java.lang.OutOfMemoryError:PermGen空間錯誤?>

type Exception report 

message 

descriptionThe server encountered an internal error() that prevented it from fulfilling this request. 

exception 

javax.servlet.ServletException: PWC1243: Filter execution threw an exception 
root cause 

java.lang.OutOfMemoryError: PermGen space 
note The full stack traces of the exception and its root causes are available in the GlassFish Server Open Source Edition 3.1.2.2 logs. 
+0

看一看這個[鏈接](http://stackoverflow.com/questions/7683434/permgen-space-error-glassfish-server).Somebody已經問過類似的題。 – aksappy 2013-02-19 05:32:00

+0

它不會對內存泄漏有幫助 - 但是可能有趣的是,Java 8已經取消了Perm Gen. – Fortyrunner 2014-04-28 04:18:19

回答

0

java.lang.OutOfMemoryError

Thrown when the Java Virtual Machine cannot allocate an object because it is out of memory, and no more memory could be made available by the garbage collector. OutOfMemoryError objects may be constructed by the virtual machine as if suppression were disabled and/or the stack trace was not writable.

檢查,如果你使用的是new關鍵字生成太多的對象。要查找的位置是循環,遞歸方法等。

0

設置PermSize在JAVA_OPTS環境變量[用於分配內存到Java的JVM如果它已經被設置 ,提高MaxPermSize參數

如:

JAVA_OPTS =「$ JAVA_OPTS -Xms512m -Xmx1024m - XX:MaxPermSize參數=1024米-XX:PermSize =128米」

約JAVA_OPTS更詳細的信息是這裏

http://www.unidata.ucar.edu/projects/THREDDS/tech/tds4.3/reference/JavaOptsSummary.html

+0

初始PermSize不會有幫助。如果你有泄漏,Max會延遲這個問題。 – ymajoros 2014-01-14 08:02:33

相關問題