-XX:PretenureSizeThreshold
HotSpot虚拟机提供了-XX:PretenureSizeThreshold
参数,指定大于该设置值的对象直接在老年代分配,这样做的目的就是避免在Eden区及两个Survivor区之间来回复制,产生大量的内存复制操作。
MapInteger, byte[]> m = new HashMapInteger, byte[]>();
for (int i = 0; i 5 * 1024; i++) {
byte[] b = new byte[1024];
m.put(i, b);
}
-Xmx30m -Xms30m -XX:+UseSerialGC -XX:+PrintGCDetails -XX:PretenureSizeThreshold=1000
Heap
def new generation total 9216K, used 6949K [0x00000000fe200000, 0x00000000fec00000, 0x00000000fec00000)
eden space 8192K, 84% used [0x00000000fe200000, 0x00000000fe8c96f0, 0x00000000fea00000)
from space 1024K, 0% used [0x00000000fea00000, 0x00000000fea00000, 0x00000000feb00000)
to space 1024K, 0% used [0x00000000feb00000, 0x00000000feb00000, 0x00000000fec00000)
tenured generation total 20480K, used 0K [0x00000000fec00000, 0x0000000100000000, 0x0000000100000000)
the space 20480K, 0% used [0x00000000fec00000, 0x00000000fec00000, 0x00000000fec00200, 0x0000000100000000)
Metaspace used 2794K, capacity 4486K, committed 4864K, reserv服务器托管网服务器托管网ed 1056768K
class space used 298K, capacity 386K, committed 512K, reserved 1048576K
5M空间还是在新生代,这里不会分配到老年代,原因是,虚拟机面对体量不大的对象,会优先分配到TLAB区域中,因此失去了分配到老年代的机会
下面禁用TLAB
-Xmx30m -Xms30m -XX:+UseSerialGC -XX:+PrintGCDetails -XX:PretenureSizeThreshold=1000 -XX:-UseTLAB
Heap
def new generation total 9216K, used 995K [0x00000000fe200000, 0x00000000fec00000, 0x00000000fec00000)
eden space 8192K, 12% used [0x00000000fe200000, 0x00000000fe2f8f50, 0x00000000fea00000)
from space 1024K, 0% used [0x00000000fea00000, 0x00000000fea00000, 0x00000000feb00000)
to space 1024K, 0% used [0x00000000feb00000, 0x00000000feb00000, 0x00000000fec00000)
tenured generation total 20480K, used 5473K [0x00000000fec00000, 0x0000000100000000, 0x0000000100000000)
the space 20480K, 26% used [0x00000000fec00000, 0x00000000ff158460, 0x00000000ff158600, 0x0000000100000000)
Metaspace used 2794K, capacity 4486K, committed 4864K, reserved 1056768K
class space used 298K, capacity 386K, committed 512K, reserved 1048576K
老年代会直接新增5M的使用量
服务器托管,北京服务器托管,服务器租用 http://www.fwqtg.net
相关推荐: [word] word2007文件打开超慢怎么办
word2007文件打开超慢怎么办? 原服务器托管网因可能有很多种,但目前我只说其中的一种,因为加载项原因导致的问题。打开WO服务器托管网RD,选择左上角的圆型按钮 点击以后,选择WORD选项。 选择加载项,COM加载项,转到 取消圆圈外的其它加载…