2015-02-05 59 views
0

得到一個奇怪的問題,從空間是100%,並且空間總是0. 任何人都可以幫助我離開這裏?java gc從100%和0%的空間

JDK 25年8月1日 OS:Linux的

獲得與JMAP

Heap Configuration: 
    MinHeapFreeRatio   = 40 
    MaxHeapFreeRatio   = 70 
    MaxHeapSize    = 32212254720 (30720.0MB) 
    NewSize     = 268435456 (256.0MB) 
    MaxNewSize    = 268435456 (256.0MB) 
    OldSize     = 31943819264 (30464.0MB) 
    NewRatio     = 5 
    SurvivorRatio   = 4 
    MetaspaceSize   = 268435456 (256.0MB) 
    CompressedClassSpaceSize = 1073741824 (1024.0MB) 
    MaxMetaspaceSize   = 268435456 (256.0MB) 
    G1HeapRegionSize   = 0 (0.0MB) 

Heap Usage: 
    New Generation (Eden + 1 Survivor Space): 
    capacity = 223739904 (213.375MB) 
    used  = 113230096 (107.98463439941406MB) 
    free  = 110509808 (105.39036560058594MB) 
    50.607913016714264% used 
Eden Space: 
    capacity = 179044352 (170.75MB) 
    used  = 68534544 (65.35963439941406MB) 
    free  = 110509808 (105.39036560058594MB) 
    38.27797036568906% used 
From Space: 
    capacity = 44695552 (42.625MB) 
    used  = 44695552 (42.625MB) 
    free  = 0 (0.0MB) 
    100.0% used 
To Space: 
    capacity = 44695552 (42.625MB) 
    used  = 0 (0.0MB) 
    free  = 44695552 (42.625MB) 
    0.0% used 
concurrent mark-sweep generation: 
    capacity = 31943819264 (30464.0MB) 
    used  = 390280592 (372.20057678222656MB) 
    free  = 31553538672 (30091.799423217773MB) 
    1.2217718513072038% used 
在gc.log

下,它總是說 '分配失敗',我怎麼能改'倖存者大小'?

[GC (Allocation Failure) 10.371: [ParNew Desired survivor size 22347776 bytes, new threshold 15 

回答

1

「分配失敗」是次要GC的正常原因(較舊的JVM未打印原因,但始終是分配失敗)。

「至空間」應始終爲空(在停止世界GC階段期間不爲空,但GC完成後始終爲0%)。

100%「從太空」也可以。通常,JVM會調整持續時間閾值以儘可能將「從空間」保持爲接近100%。儘管如此,確切地說,達到100%意味着對某些物體過早提升。

生存空間的大小由-XX:SurvivorRatio=N選項控制。使用-XX:+PrintTenuringDistribution對調整年輕GC很有用。

Here可以找到更多與GC調整相關的JVM選項。

+0

謝謝!將嘗試-XX:SurvivorRatio = N和XX:+ PrintTenuringDistribution – user3644708 2015-02-06 12:43:28

+0

@StephenC HotSpot JVM中的所有年輕收藏家(包括G1)都是停止世界(即不是併發) – 2015-02-06 20:00:13

+0

我今天學到了一些東西... – 2015-02-07 01:08:32