当前位置: 动力学知识库 > 问答 > 编程问答 >

java - getting permgen space fom jmap

问题描述:

I am using java version "1.6.0_31" (I know old version). I am using jmap -heap to view my process's permgen usage. However, when I look at the output, I see these lines, which seem to tell me that my current permspace usage is 12MB

Heap Configuration:

MinHeapFreeRatio = 40

MaxHeapFreeRatio = 70

MaxHeapSize = 209715200 (200.0MB)

NewSize = 1048576 (1.0MB)

MaxNewSize = 4294901760 (4095.9375MB)

OldSize = 4194304 (4.0MB)

NewRatio = 2

SurvivorRatio = 8

PermSize = 12582912 (12.0MB)

MaxPermSize = 67108864 (64.0MB)

And then later in the output I see these lines, which seem to tell me that I have used about 20MB perm usage. My question is, why are these two numbers different from each other. Which is more relevant? (I am not running out of Permspace, I am just trying to understand the output).

Perm Generation:

capacity = 20447232 (19.5MB)

used = 20246088 (19.30817413330078MB)

free = 201144 (0.19182586669921875MB)

网友答案:

As you can see here

  PermSize         = 12582912 (12.0MB)
  MaxPermSize      = 67108864 (64.0MB)

Your initial PermGen size is 12MB but it can increase upto 64MB. So as and when you load classes, PermGen usage will go up, that's the reason it went up from 12MB to 20MB and it'll continue to increase until it reaches the max capacity and then it will throw the infamous java.lang.OutOfMemoryError: PermGen space. Just set

-XX:PermSize=128m and -XX:MaxPermSize=128m.

The reason for setting same value is to avoid full GCs when there's a resize

分享给朋友:
您可能感兴趣的文章:
随机阅读: