简体   繁体   中英

Max Heap Size for Tomcat 6 on 64 bit CentOs?

I am running a tomcat 6 instance on a large EC2 instance running CentOS 5.4. The box has 7.5gb of RAM and is dedicated to running tomcat.

I am trying to give the box 6gb of RAM to use for it's max heap. However I keep getting this error:

Invalid maximum heap size: -Xmx6144m
The specified size exceeds the maximum representable size.

As I drop the amount of RAM I give it I start getting this error instead:

Error occurred during initialization of VM
Could not reserve enough space for object heap

Even with the app running (with xmx3000m) when I run free I have this amount free:

 [tomcat@producer1:/usr/share/tomcat/logs] $free
             total       used       free     shared    buffers     cached
Mem:       7864320    1512736    6351584          0     179948     702352
-/+ buffers/cache:     630436    7233884
Swap:            0          0          0

The most I am able to give it is 3000m. This seems unreasonably small. Anyone have any ideas? Thanks

Do you have 64 bit JDK installed? If you are using a 32 bit JDK it can max access 4GB (theoretically). As you are planning for 6GB, you require 64bit JDK. Added to that as you have 7.5G, 6GB is a tight no. CentOS requires some memory for kernal, processing other services, SWAP memory from this.

So give a trial & error by increasing heap size from 5G onwards. JDK requires additional memory beyond heap like permgenspace (which is typically 128M - 512M depending on how many libraries/classloaders you have)

Refer to : http://benjchristensen.com/2007/02/16/32-bit-versus-64-bit-jdk-memory-usage/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM