Java HotSpot(TM) 64-Bit Server VM (25.152-b16) for bsd-amd64 JRE (1.8.0_152-b16), built on Sep 14 2017 02:31:13 by "java_re" with gcc 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
Memory: 4k page, physical 8388608k(189488k free)
/proc/meminfo:
CommandLine flags: -XX:InitialHeapSize=20971520 -XX:MaxHeapSize=20971520 -XX:MaxNewSize=10485760 -XX:NewSize=10485760 -XX:+PrintGC -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:SurvivorRatio=8 -XX:-UseCompressedClassPointers -XX:-UseCompressedOops -XX:+UseSerialGC
0.191: [GC (Allocation Failure) 0.191: [DefNew: 6443K->679K(9216K), 0.0067661 secs] 6443K->4775K(19456K), 0.0069140 secs] [Times: user=0.00 sys=0.01, real=0.01 secs]
Heap
def new generation total 9216K, used 7145K [0x0000000103c00000, 0x0000000104600000, 0x0000000104600000)
eden space 8192K, 78% used [0x0000000103c00000, 0x0000000104250748, 0x0000000104400000)
from space 1024K, 66% used [0x0000000104500000, 0x00000001045a9f78, 0x0000000104600000)
to space 1024K, 0% used [0x0000000104400000, 0x0000000104400000, 0x0000000104500000)
tenured generation total 10240K, used 4096K [0x0000000104600000, 0x0000000105000000, 0x0000000105000000)
the space 10240K, 40% used [0x0000000104600000, 0x0000000104a00030, 0x0000000104a00200, 0x0000000105000000)
Metaspace used 3187K, capacity 4112K, committed 4352K, reserved 8192K
package idv.java.jvm.gc.memoryallocate.pretenure;
/**
* @author Carl Lu
* VM args: -Xloggc:gclog-PretenureDemo.log -Xms20M -Xmx20M -Xmn10M -XX:+PrintGCDetails -XX:SurvivorRatio=8 -XX:+UseSerialGC -XX:PretenureSizeThreshold=3145728 -XX:-UseCompressedClassPointers -XX:-UseCompressedOops
* Here we use 3145728(byte) to represent 3MB since this can not be written as 3M for "PretenureSizeThreshold".
* 3145728/1024/1024 = 3(MB)
*/
public class PretenureDemo {
private static final int _1MB = 1024 * 1024;
public static void main(String[] args) {
byte[] allocatetion;
allocatetion = new byte[4 * _1MB];
}
}
Java HotSpot(TM) 64-Bit Server VM (25.152-b16) for bsd-amd64 JRE (1.8.0_152-b16), built on Sep 14 2017 02:31:13 by "java_re" with gcc 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
Memory: 4k page, physical 8388608k(211428k free)
/proc/meminfo:
CommandLine flags: -XX:InitialHeapSize=20971520 -XX:MaxHeapSize=20971520 -XX:MaxNewSize=10485760 -XX:NewSize=10485760 -XX:PretenureSizeThreshold=3145728 -XX:+PrintGC -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:SurvivorRatio=8 -XX:-UseCompressedClassPointers -XX:-UseCompressedOops -XX:+UseSerialGC
Heap
def new generation total 9216K, used 2550K [0x0000000104800000, 0x0000000105200000, 0x0000000105200000)
eden space 8192K, 31% used [0x0000000104800000, 0x0000000104a7daf0, 0x0000000105000000)
from space 1024K, 0% used [0x0000000105000000, 0x0000000105000000, 0x0000000105100000)
to space 1024K, 0% used [0x0000000105100000, 0x0000000105100000, 0x0000000105200000)
tenured generation total 10240K, used 4096K [0x0000000105200000, 0x0000000105c00000, 0x0000000105c00000)
the space 10240K, 40% used [0x0000000105200000, 0x0000000105600018, 0x0000000105600200, 0x0000000105c00000)
Metaspace used 3296K, capacity 4112K, committed 4352K, reserved 8192K
package idv.java.jvm.gc.memoryallocate.tenuringthreshold;
/**
* @author Carl Lu
* VM args:
* -Xloggc:gclog-TenuringThresholdEqualsTo1Demo.log -Xms20M -Xmx20M -Xmn10M -XX:+PrintGCDetails -XX:SurvivorRatio=8 -XX:MaxTenuringThreshold=1 -XX:+PrintTenuringDistribution -XX:-UseCompressedClassPointers -XX:-UseCompressedOops -XX:+UseSerialGC
* -Xloggc:gclog-TenuringThresholdEqualsTo7Demo.log -Xms20M -Xmx20M -Xmn10M -XX:+PrintGCDetails -XX:SurvivorRatio=8 -XX:MaxTenuringThreshold=7 -XX:+PrintTenuringDistribution -XX:-UseCompressedClassPointers -XX:-UseCompressedOops -XX:-UseAdaptiveSizePolicy -XX:+UseParNewGC
*/
public class TenuringThresholdDemo {
private static final int _1MB = 1024 * 1024;
public static void main(String[] args) {
byte[] allocation1, allocation2, allocation3;
allocation1 = new byte[_1MB / 4];
allocation2 = new byte[4 * _1MB];
allocation3 = new byte[4 * _1MB];
allocation3 = null;
allocation3 = new byte[4 * _1MB];
}
}
Java HotSpot(TM) 64-Bit Server VM (25.152-b16) for bsd-amd64 JRE (1.8.0_152-b16), built on Sep 14 2017 02:31:13 by "java_re" with gcc 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
Memory: 4k page, physical 8388608k(229412k free)
/proc/meminfo:
CommandLine flags: -XX:InitialHeapSize=20971520 -XX:InitialTenuringThreshold=1 -XX:MaxHeapSize=20971520 -XX:MaxNewSize=10485760 -XX:MaxTenuringThreshold=1 -XX:NewSize=10485760 -XX:+PrintGC -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintTenuringDistribution -XX:SurvivorRatio=8 -XX:-UseCompressedClassPointers -XX:-UseCompressedOops -XX:+UseSerialGC
0.220: [GC (Allocation Failure) 0.220: [DefNew
Desired survivor size 524288 bytes, new threshold 1 (max 1)
- age 1: 972088 bytes, 972088 total
: 6902K->949K(9216K), 0.0068881 secs] 6902K->5045K(19456K), 0.0070786 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
0.228: [GC (Allocation Failure) 0.228: [DefNew
Desired survivor size 524288 bytes, new threshold 1 (max 1)
- age 1: 2992 bytes, 2992 total
: 5129K->2K(9216K), 0.0019897 secs] 9225K->5018K(19456K), 0.0020846 secs] [Times: user=0.00 sys=0.00, real=0.01 secs]
Heap
def new generation total 9216K, used 4236K [0x0000000117200000, 0x0000000117c00000, 0x0000000117c00000)
eden space 8192K, 51% used [0x0000000117200000, 0x00000001176227d0, 0x0000000117a00000)
from space 1024K, 0% used [0x0000000117a00000, 0x0000000117a00bb0, 0x0000000117b00000)
to space 1024K, 0% used [0x0000000117b00000, 0x0000000117b00000, 0x0000000117c00000)
tenured generation total 10240K, used 5015K [0x0000000117c00000, 0x0000000118600000, 0x0000000118600000)
the space 10240K, 48% used [0x0000000117c00000, 0x00000001180e5fe8, 0x00000001180e6000, 0x0000000118600000)
Metaspace used 3288K, capacity 4112K, committed 4352K, reserved 8192K
Java HotSpot(TM) 64-Bit Server VM (25.152-b16) for bsd-amd64 JRE (1.8.0_152-b16), built on Sep 14 2017 02:31:13 by "java_re" with gcc 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
Memory: 4k page, physical 8388608k(169340k free)
/proc/meminfo:
CommandLine flags: -XX:InitialHeapSize=20971520 -XX:MaxHeapSize=20971520 -XX:MaxNewSize=10485760 -XX:MaxTenuringThreshold=7 -XX:NewSize=10485760 -XX:+PrintGC -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintTenuringDistribution -XX:SurvivorRatio=8 -XX:-UseAdaptiveSizePolicy -XX:-UseCompressedClassPointers -XX:-UseCompressedOops -XX:+UseParNewGC
0.216: [GC (Allocation Failure) 0.216: [ParNew
Desired survivor size 524288 bytes, new threshold 1 (max 7)
- age 1: 971880 bytes, 971880 total
: 6902K->974K(9216K), 0.0045596 secs] 6902K->5070K(19456K), 0.0047542 secs] [Times: user=0.00 sys=0.00, real=0.01 secs]
0.222: [GC (Allocation Failure) 0.222: [ParNew
Desired survivor size 524288 bytes, new threshold 7 (max 7)
- age 1: 536 bytes, 536 total
: 5154K->295K(9216K), 0.0008993 secs] 9250K->5338K(19456K), 0.0010252 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
Heap
par new generation total 9216K, used 4529K [0x0000000102000000, 0x0000000102a00000, 0x0000000102a00000)
eden space 8192K, 51% used [0x0000000102000000, 0x0000000102422828, 0x0000000102800000)
from space 1024K, 28% used [0x0000000102800000, 0x0000000102849c80, 0x0000000102900000)
to space 1024K, 0% used [0x0000000102900000, 0x0000000102900000, 0x0000000102a00000)
tenured generation total 10240K, used 5043K [0x0000000102a00000, 0x0000000103400000, 0x0000000103400000)
the space 10240K, 49% used [0x0000000102a00000, 0x0000000102eecc00, 0x0000000102eecc00, 0x0000000103400000)
Metaspace used 3289K, capacity 4112K, committed 4352K, reserved 8192K
package idv.java.jvm.gc.memoryallocate.tenuringthreshold;
/**
* @author Carl Lu
*/
public class TenuringThresholdDemo2 {
private static final int _1MB = 1024 * 1024;
public static void main(String[] args) {
byte[] allocation1, allocation2, allocation3, allocation4;
allocation1 = new byte[_1MB / 4];
allocation2 = new byte[_1MB / 4];
allocation3 = new byte[4 * _1MB];
allocation4 = new byte[4 * _1MB];
allocation4 = null;
allocation4 = new byte[4 * _1MB];
}
}
Java HotSpot(TM) 64-Bit Server VM (25.152-b16) for bsd-amd64 JRE (1.8.0_152-b16), built on Sep 14 2017 02:31:13 by "java_re" with gcc 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
Memory: 4k page, physical 8388608k(206472k free)
/proc/meminfo:
CommandLine flags: -XX:InitialHeapSize=20971520 -XX:MaxHeapSize=20971520 -XX:MaxNewSize=10485760 -XX:MaxTenuringThreshold=15 -XX:NewSize=10485760 -XX:+PrintGC -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintTenuringDistribution -XX:SurvivorRatio=8 -XX:-UseCompressedClassPointers -XX:-UseCompressedOops -XX:+UseSerialGC
0.281: [GC (Allocation Failure) 0.281: [DefNew
Desired survivor size 524288 bytes, new threshold 1 (max 15)
- age 1: 1048576 bytes, 1048576 total
: 7158K->1024K(9216K), 0.0073013 secs] 7158K->5326K(19456K), 0.0074506 secs] [Times: user=0.01 sys=0.01, real=0.00 secs]
0.290: [GC (Allocation Failure) 0.290: [DefNew
Desired survivor size 524288 bytes, new threshold 15 (max 15)
: 5120K->0K(9216K), 0.0034517 secs] 9422K->5326K(19456K), 0.0035425 secs] [Times: user=0.00 sys=0.00, real=0.01 secs]
Heap
def new generation total 9216K, used 4178K [0x0000000110800000, 0x0000000111200000, 0x0000000111200000)
eden space 8192K, 51% used [0x0000000110800000, 0x0000000110c14970, 0x0000000111000000)
from space 1024K, 0% used [0x0000000111000000, 0x0000000111000000, 0x0000000111100000)
to space 1024K, 0% used [0x0000000111100000, 0x0000000111100000, 0x0000000111200000)
tenured generation total 10240K, used 5326K [0x0000000111200000, 0x0000000111c00000, 0x0000000111c00000)
the space 10240K, 52% used [0x0000000111200000, 0x00000001117339c8, 0x0000000111733a00, 0x0000000111c00000)
Metaspace used 3303K, capacity 4112K, committed 4352K, reserved 8192K
Java HotSpot(TM) 64-Bit Server VM (25.152-b16) for bsd-amd64 JRE (1.8.0_152-b16), built on Sep 14 2017 02:31:13 by "java_re" with gcc 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
Memory: 4k page, physical 8388608k(232432k free)
/proc/meminfo:
CommandLine flags: -XX:InitialHeapSize=20971520 -XX:MaxHeapSize=20971520 -XX:MaxNewSize=10485760 -XX:MaxTenuringThreshold=15 -XX:NewSize=10485760 -XX:+PrintGC -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintTenuringDistribution -XX:SurvivorRatio=8 -XX:-UseCompressedClassPointers -XX:-UseCompressedOops -XX:+UseSerialGC
0.305: [GC (Allocation Failure) 0.305: [DefNew
Desired survivor size 524288 bytes, new threshold 1 (max 15)
- age 1: 976104 bytes, 976104 total
: 6902K->953K(9216K), 0.0034486 secs] 6902K->953K(19456K), 0.0036413 secs] [Times: user=0.01 sys=0.00, real=0.00 secs]
Heap
def new generation total 9216K, used 5215K [0x000000011b400000, 0x000000011be00000, 0x000000011be00000)
eden space 8192K, 52% used [0x000000011b400000, 0x000000011b8299b0, 0x000000011bc00000)
from space 1024K, 93% used [0x000000011bd00000, 0x000000011bdee4e8, 0x000000011be00000)
to space 1024K, 0% used [0x000000011bc00000, 0x000000011bc00000, 0x000000011bd00000)
tenured generation total 10240K, used 0K [0x000000011be00000, 0x000000011c800000, 0x000000011c800000)
the space 10240K, 0% used [0x000000011be00000, 0x000000011be00000, 0x000000011be00200, 0x000000011c800000)
Metaspace used 3298K, capacity 4112K, committed 4352K, reserved 8192K
package idv.java.jvm.gc.memoryallocate.forcepromotion;
/**
* @author Carl Lu
* VM args: -Xloggc:gclog-ForcePromotionDemo.log -Xms20M -Xmx20M -Xmn10M -XX:+PrintGCDetails -XX:SurvivorRatio=8 -XX:+PrintTenuringDistribution -XX:-UseCompressedClassPointers -XX:-UseCompressedOops -XX:+UseSerialGC
*/
public class ForcePromotionDemo {
private static final int _1MB = 1024 * 1024;
public static void main(String[] args) {
byte[] allocation1, allocation2, allocation3, allocation4, allocation5, allocation6, allocation7;
allocation1 = new byte[2 * _1MB];
allocation2 = new byte[2 * _1MB];
allocation3 = new byte[2 * _1MB];
allocation1 = null;
allocation4 = new byte[2 * _1MB];
allocation5 = new byte[2 * _1MB];
allocation6 = new byte[2 * _1MB];
allocation4 = null;
allocation5 = null;
allocation6 = null;
allocation7 = new byte[2 * _1MB];
}
}
Java HotSpot(TM) 64-Bit Server VM (25.152-b16) for bsd-amd64 JRE (1.8.0_152-b16), built on Sep 14 2017 02:31:13 by "java_re" with gcc 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
Memory: 4k page, physical 8388608k(223884k free)
/proc/meminfo:
CommandLine flags: -XX:InitialHeapSize=20971520 -XX:MaxHeapSize=20971520 -XX:MaxNewSize=10485760 -XX:NewSize=10485760 -XX:+PrintGC -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintTenuringDistribution -XX:SurvivorRatio=8 -XX:-UseCompressedClassPointers -XX:-UseCompressedOops -XX:+UseSerialGC
0.249: [GC (Allocation Failure) 0.249: [DefNew
Desired survivor size 524288 bytes, new threshold 1 (max 15)
- age 1: 709448 bytes, 709448 total
: 6646K->692K(9216K), 0.0066271 secs] 6646K->4788K(19456K), 0.0068361 secs] [Times: user=0.00 sys=0.00, real=0.01 secs]
0.257: [GC (Allocation Failure) 0.258: [DefNew (promotion failed) : 7076K->6383K(9216K), 0.0059956 secs]0.264: [Tenured: 8855K->8854K(10240K), 0.0055091 secs] 11172K->8854K(19456K), [Metaspace: 3279K->3279K(8192K)], 0.0116887 secs] [Times: user=0.01 sys=0.01, real=0.01 secs]
Heap
def new generation total 9216K, used 4480K [0x0000000111e00000, 0x0000000112800000, 0x0000000112800000)
eden space 8192K, 54% used [0x0000000111e00000, 0x00000001122600f8, 0x0000000112600000)
from space 1024K, 0% used [0x0000000112600000, 0x0000000112600000, 0x0000000112700000)
to space 1024K, 0% used [0x0000000112700000, 0x0000000112700000, 0x0000000112800000)
tenured generation total 10240K, used 8854K [0x0000000112800000, 0x0000000113200000, 0x0000000113200000)
the space 10240K, 86% used [0x0000000112800000, 0x00000001130a5ae0, 0x00000001130a5c00, 0x0000000113200000)
Metaspace used 3285K, capacity 4112K, committed 4352K, reserved 8192K
Java HotSpot(TM) 64-Bit Server VM (25.152-b16) for bsd-amd64 JRE (1.8.0_152-b16), built on Sep 14 2017 02:31:13 by "java_re" with gcc 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
Memory: 4k page, physical 8388608k(190140k free)
/proc/meminfo:
CommandLine flags: -XX:InitialHeapSize=20971520 -XX:MaxHeapSize=20971520 -XX:MaxNewSize=10485760 -XX:NewSize=10485760 -XX:+PrintGC -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:SurvivorRatio=8 -XX:-UseCompressedClassPointers -XX:-UseCompressedOops -XX:+UseSerialGC
0.279: [GC (Allocation Failure) 0.279: [DefNew: 6482K->718K(9216K), 0.0070587 secs] 6482K->4814K(19456K), 0.0072504 secs] [Times: user=0.01 sys=0.01, real=0.01 secs]
0.288: [GC (Allocation Failure) 0.288: [DefNew (promotion failed) : 7019K->6301K(9216K), 0.0057992 secs]0.294: [Tenured: 8881K->8880K(10240K), 0.0057257 secs] 11115K->8880K(19456K), [Metaspace: 3291K->3291K(8192K)], 0.0117102 secs] [Times: user=0.01 sys=0.00, real=0.01 secs]
Heap
def new generation total 9216K, used 4563K [0x0000000110a00000, 0x0000000111400000, 0x0000000111400000)
eden space 8192K, 55% used [0x0000000110a00000, 0x0000000110e74f70, 0x0000000111200000)
from space 1024K, 0% used [0x0000000111200000, 0x0000000111200000, 0x0000000111300000)
to space 1024K, 0% used [0x0000000111300000, 0x0000000111300000, 0x0000000111400000)
tenured generation total 10240K, used 8880K [0x0000000111400000, 0x0000000111e00000, 0x0000000111e00000)
the space 10240K, 86% used [0x0000000111400000, 0x0000000111cac000, 0x0000000111cac000, 0x0000000111e00000)
Metaspace used 3297K, capacity 4112K, committed 4352K, reserved 8192K