我已经使用Tomcat的JAVA_OPTS变量设置了PermSize和MaxPermSize的值,如下所示。
JAVA_OPTS="$JAVA_OPTS -XX:PermSize=512M"
JAVA_OPTS="$JAVA_OPTS -XX:MaxPermSize=512M"
并且将 Xms 和 Xmx 的值设置为
JAVA_OPTS="$JAVA_OPTS -Xms1024M"
JAVA_OPTS="$JAVA_OPTS -Xmx1024M"
但是当我使用命令jmap -heap [进程 ID]检查perm-gen的实际大小时,它们显示为
Heap Configuration:
MinHeapFreeRatio = 40
MaxHeapFreeRatio = 70
MaxHeapSize = 792723456 (756.0MB)
NewSize = 1310720 (1.25MB)
MaxNewSize = 17592186044415
OldSize = 5439488 (5.1875MB)
NewRatio = 2
SurvivorRatio = 8
**PermSize = 21757952 (20.75MB)**
**MaxPermSize = 85983232 (82.0MB)**
G1HeapRegionSize = 0 (0.0MB)
Perm Generation:
**capacity = 69271552 (66.0625MB)**
**used = 69247376 (66.03944396972656MB)**
**free = 24176 (0.0230560302734375MB)**
**99.96509967035242% used**
为什么实际分配的持久代空间与使用PermSize和MaxPermSize属性分配的不同?
额外信息:安装Tomcat服务器的Linux机器的RAM大小为:
total used free shared buffers cached
Mem: 3089928 3006592 83336 0 67828 1874144
-/+ buffers/cache: 1064620 2025308
Swap: 1020088 112 1019976