2012-10-14 27 views
1

我有4G內存(64位)。目前,我在Eclipse IDE(JUNO)中使用默認內存設置。當我在JBoss 7.1上部署應用程序時,出現Out Of Memory錯誤。我想知道heap memorypermgen memorymemory ratio?比方說,如果我爲堆內存設置1G內存,那麼Permgen內存將爲512M,就是例子。如果是這樣,permgen將是堆內存的50%。你能爲他們提供內存分配的方式嗎?如何正常爲4G分配堆和Permgen內存?

目前的eclipse.ini

-startup 
plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar 
--launcher.library 
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.200.v20120522-1813 
-product 
org.eclipse.epp.package.jee.product 
--launcher.defaultAction 
openFile 
--launcher.XXMaxPermSize 
512M 
-showsplash 
org.eclipse.platform 
--launcher.XXMaxPermSize 
512m 
--launcher.defaultAction 
openFile 
-vmargs 
-Dosgi.requiredJavaVersion=1.5 
-Dhelp.lucene.tokenizer=standard 
-Xms128m 
-Xmx1024m 

原因:

Caused by: java.lang.OutOfMemoryError: Java heap space 

回答

2

這取決於你所看到的典型的內存使用情況。當你遇到內存不足錯誤時,應該說它是用於perm gen還是堆空間;相應調整。

編輯:如果它說你離開堆空間,那麼它就是你想增加的Xmx1024m。也許試試Xmx2g。

我也假設它是Eclipse,你看到OutOfMemoryError的?如果它實際上是用於JBoss,那麼eclipse.ini將無法幫助,因爲當您部署到JBoss時,它將成爲不同的虛擬機。在這種情況下,你想增加在$ JBOSS_HOME的XMX值/斌/ appclient.conf

+0

請修改它。因爲'java.lang.OutOfMemoryError:Java堆空間' – CycDemo

+0

根據你的回答,我必須在'JBoss appclient.conf'中配置,因爲我在JBoss AS上部署應用程序時出現錯誤。 thz,我會嘗試。 – CycDemo

1

I would like to know memory ratio of heap memory and permgen memory?

沒有固定的比率。堆內存和permgen內存大小是獨立指定的,使用不同的參數。

我的建議是單獨保留permgen設置......除非OOME消息告訴你已經用完了permgen內存。