how to allocate Heap and Permgen memory for 4G normally?

心不动则不痛 提交于 2019-12-24 11:29:36

问题


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?

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

Cause :

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

回答1:


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.

Edit: If it's saying you're out of heap space then it's the Xmx1024m you want to increase. Perhaps try Xmx2g.

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




回答2:


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

There is no fixed ratio. The heap memory and permgen memory sizes are specified independently, using different parameters.

My advice would be to leave the permgen setting alone ... unless an OOME message tells you that you have run out of permgen memory.



来源:https://stackoverflow.com/questions/12880346/how-to-allocate-heap-and-permgen-memory-for-4g-normally

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!