我将nashorn与jdk1.8一起使用,然后运行它。我发现GC经常发生。我得到的实例数是jmap -histo PID
,PropertyHashMap$Element
和SpillProperty
的实例过多:
java:
new ScriptEngineManager().getEngineByName("nashorn");
jmap -histo:
num #instances #bytes class name
----------------------------------------------
1: 923913 169207440 [C
2: 864617 27667744 jdk.nashorn.internal.runtime.PropertyHashMap$Element
3: 917296 22015104 java.lang.String
4: 350381 19621336 jdk.nashorn.internal.runtime.SpillProperty
同一个程序的问题2,cmd jmap –heap PID
显示出From Space和To Space都使用了0%,但是我的jvm args是--XX:MaxTenuringThreshold=10
,可以吗?
Heap Usage:
New Generation (Eden + 1 Survivor Space):
capacity = 1207959552 (1152.OMB)
used = 348986376 (332.81934356689453MB)
free = 858973176 (819.18065643310SSHB)
28.890568017959595% used
Eden Space:
capacity = 1073741824 (1024.0MB)
used = 348986376 (332.81934356689453MB)
free = 724755448 (691.18065643310SSHB)
32.501889020204544% used
From Space:
capacity = 134217728 (128.0MB)
used =0 (0.0MB)
free = 134217728 (128.0MB)
0.0% used
To Space:
capacity = 134217728 (128.0MB)
used =0 (0.0MB)
free = 134217728(128.0MB)
0.0% used
concurrent mark-sweep generation:
capacity = 268435456 (256.0MB)
used = 268434736 (255.9993133S44922HB)
free = 720 (6.8664SS07812SE-4HB)
99.99973177909851% used