[讨论] SurvivorRation 好诡异
xgj1988
2015-08-12
做了一个实验。Vm 参数是,-Xmx100m -Xms100m -Xmn20m 用的默认SurvivorRatio是没设置的,也就是8。然后我jmap -heap 得到的结果是:
using thread-local object allocation. Parallel GC with 4 thread(s) Heap Configuration: MinHeapFreeRatio = 40 MaxHeapFreeRatio = 70 MaxHeapSize = 104857600 (100.0MB) NewSize = 20971520 (20.0MB) MaxNewSize = 20971520 (20.0MB) OldSize = 5439488 (5.1875MB) NewRatio = 2 SurvivorRatio = 8 PermSize = 21757952 (20.75MB) MaxPermSize = 85983232 (82.0MB) G1HeapRegionSize = 0 (0.0MB) Heap Usage: PS Young Generation Eden Space: capacity = 15728640 (15.0MB) used = 4357336 (4.155479431152344MB) free = 11371304 (10.844520568847656MB) 27.703196207682293% used From Space: capacity = 2621440 (2.5MB) used = 2588848 (2.4689178466796875MB) free = 32592 (0.0310821533203125MB) 98.7567138671875% used To Space: capacity = 2621440 (2.5MB) used = 0 (0.0MB) free = 2621440 (2.5MB) 0.0% used PS Old Generation capacity = 83886080 (80.0MB) used = 13364112 (12.745010375976562MB) free = 70521968 (67.25498962402344MB) 15.931262969970703% used PS Perm Generation capacity = 23068672 (22.0MB) used = 23043336 (21.97583770751953MB) free = 25336 (0.02416229248046875MB) 99.89017139781605% used 10662 interned Strings occupying 920664 bytes. 注意看两个survivior都是2.5M 但是我手动设置一下SurvivorRatio=8。也就是vm设置成 -Xmx100m -Xms100m -Xmn20m -XX:SurvivorRatio=8 得到的结果是 using thread-local object allocation. Parallel GC with 4 thread(s) Heap Configuration: MinHeapFreeRatio = 40 MaxHeapFreeRatio = 70 MaxHeapSize = 104857600 (100.0MB) NewSize = 20971520 (20.0MB) MaxNewSize = 20971520 (20.0MB) OldSize = 5439488 (5.1875MB) NewRatio = 2 SurvivorRatio = 8 PermSize = 21757952 (20.75MB) MaxPermSize = 85983232 (82.0MB) G1HeapRegionSize = 0 (0.0MB) Heap Usage: PS Young Generation Eden Space: capacity = 16777216 (16.0MB) used = 689544 (0.6576004028320312MB) free = 16087672 (15.342399597167969MB) 4.110002517700195% used From Space: capacity = 2097152 (2.0MB) used = 2089152 (1.99237060546875MB) free = 8000 (0.00762939453125MB) 99.6185302734375% used To Space: capacity = 2097152 (2.0MB) used = 0 (0.0MB) free = 2097152 (2.0MB) 0.0% used PS Old Generation capacity = 83886080 (80.0MB) used = 14887688 (14.198005676269531MB) free = 68998392 (65.80199432373047MB) 17.747507095336914% used PS Perm Generation capacity = 23068672 (22.0MB) used = 23043440 (21.975936889648438MB) free = 25232 (0.0240631103515625MB) 99.89062222567472% used 10647 interned Strings occupying 919560 bytes. 注意看两个survivior确是2.0M 很明显第二个才应该是对的。。那么问题来了。为什么默认是8的情况下,得到的结果确实2.5呢? 操作系统是win7 JDK是: java version "1.7.0_51" Java(TM) SE Runtime Environment (build 1.7.0_51-b13) Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode) |
|
xgj1988
2015-08-12
R大已经解释了。 位置在:http://hllvm.group.iteye.com/group/topic/35468
|