通常如何为4G分配堆和Permgen内存? [英] how to allocate Heap and Permgen memory for 4G normally?
问题描述
我有4G内存(64位).当前,我在Eclipse IDE(JUNO)中使用默认内存设置.在JBoss 7.1
上部署应用程序时,出现Out Of Memory
错误.我想知道heap memory
和permgen memory
的memory ratio
吗?假设,如果我将1G内存设置为堆内存,则permgen内存将为512M,仅此而已.如果是这样,permgen将占堆内存的50%.您能为他们提供分配内存的方法吗?
I have 4G memory(64-bit). Currently, I use default memory setting in Eclipse IDE(JUNO). when I deploy the application on JBoss 7.1
I get Out Of Memory
error. I would like to know memory ratio
of heap memory
and permgen memory
? Let say, if I set 1G memory for heap memory, permgen memory will be 512M, just example. If so, permgen will be 50% of heap memory. Could you provide the way for memory allocatation for them?
当前为eclipse.ini
Currently 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
推荐答案
这取决于您看到的典型内存使用情况.当出现内存不足错误时,应该说出它是用于perm gen还是堆空间;进行相应的调整.
It depends on the typical memory usage you're seeing. When you get an out of memory error it should say if it's for perm gen or heap space; adjust accordingly.
如果说您的堆空间不足,则是您要增加的Xmx1024m.也许尝试Xmx2g.
If it's saying you're out of heap space then it's the Xmx1024m you want to increase. Perhaps try Xmx2g.
我还假设是Eclipse,您正在看到OutOfMemoryError吗?如果实际上是针对JBoss的,那么eclipse.ini将无济于事,因为当您部署到JBoss时,它将是另一台VM.在这种情况下,您需要增加$ JBOSS_HOME/bin/appclient.conf
I've also assumed it's Eclipse you're seeing the OutOfMemoryError for? If it's actually for JBoss then eclipse.ini won't help as when you deploy to JBoss it'll be a different VM. In that case you'd want to increase the Xmx value in $JBOSS_HOME/bin/appclient.conf
这篇关于通常如何为4G分配堆和Permgen内存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!