how to allocate Heap and Permgen memory for 4G nor

2019-08-03 16:58发布

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

2条回答
姐就是有狂的资本
2楼-- · 2019-08-03 17:38

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.

查看更多
\"骚年 ilove
3楼-- · 2019-08-03 17:39

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

查看更多
登录 后发表回答