3

我在运行 CentOS 5.4 的大型 EC2 实例上运行 tomcat 6 实例。该盒子有 7.5gb 的 RAM,专用于运行 tomcat。

我试图给盒子 6gb 的 RAM 用于它的最大堆。但是我不断收到此错误:

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

当我减少我给它的 RAM 量时,我开始收到这个错误:

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

即使在我免费运行时运行应用程序(使用 xmx3000m),我也有这个免费数量:

 [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

我最多可以给它3000m。这似乎小得不合理。有人有想法么?谢谢

4

1 回答 1

3

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/

于 2011-03-09T17:26:02.730 回答