Java 8 GC Tutorials - Herong's Tutorial Examples - v1.03, by Dr. Herong Yang
Archived: 1076/800/80MB Test on HotSpot Client 1.6
This section provides a tutorial example on running GCTest2.java on HotSpot Client JVM 1.6.0_45 with 1076MB memory limit and a 800MB base plus 80MB fluctuating memory usage with object size of 1.25MB.
As a comparison, I ran GCTest2.java with the same parameters on HotSpot Client 1.6.0_45 my Windows 7 system:
herong> \Progra~1\java\jrockit-jdk1.6.0_45-R28.2.7-4.1.0\bin\javac
GCTest2.java
herong> \Progra~1\java\jdk1.6.0_45\bin\java -Xmx1076m GCTest2 1280 640 64
Test parameters:
Object size: 1280KB
Initial objects and data size: 640, 819200KB
Added objects and data size: 64, 81920KB
Time Total Free Used Free Total Act. Dead Over
sec. Mem. Mem. Mem. %. Obj. Obj. Obj. Head
1 1065152 163847 901305 15% 901120 819200 81920 185
2 1065152 81926 983226 7% 983040 819200 163840 186
3 1065152 163852 901300 15% 901120 819200 81920 180
4 1065152 81931 983221 7% 983040 819200 163840 181
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at GCTest2$MyObject.<init>(GCTest2.java:70)
at GCTest2.myTest(GCTest2.java:37)
\Progra~1\java\jdk1.6.0_45\bin\java -Xmx1077m GCTest2 1280 640 64
Test parameters:
Object size: 1280KB
Initial objects and data size: 640, 819200KB
Added objects and data size: 64, 81920KB
Time Total Free Used Free Total Act. Dead Over
sec. Mem. Mem. Mem. %. Obj. Obj. Obj. Head
1 1067136 165831 901305 15% 901120 819200 81920 185
2 1067136 83910 983226 7% 983040 819200 163840 186
3 1067136 1985 1065151 0% 901120 819200 81920 164031
5 1067136 83914 983222 7% 901120 819200 81920 82102
6 1067136 1993 1065143 0% 983040 819200 163840 82103
7 1067136 1993 1065143 0% 901120 819200 81920 164023
9 1067136 83916 983220 7% 901120 819200 81920 82100
10 1067136 1993 1065143 0% 983040 819200 163840 82103
11 1067136 1995 1065141 0% 901120 819200 81920 164021
12 1067136 83917 983219 7% 901120 819200 81920 82099
13 1067136 1993 1065143 0% 983040 819200 163840 82103
15 1067136 1994 1065142 0% 901120 819200 81920 164022
16 1067136 83910 983226 7% 901120 819200 81920 82106
17 1067136 1983 1065153 0% 983040 819200 163840 82113
19 1067136 1980 1065156 0% 901120 819200 81920 164036
20 1067136 83917 983219 7% 901120 819200 81920 82099
21 1067136 1952 1065184 0% 983040 819200 163840 82144
22 1067136 1991 1065145 0% 901120 819200 81920 164025
24 1067136 83917 983219 7% 901120 819200 81920 82099
25 1067136 1949 1065187 0% 983040 819200 163840 82147
26 1067136 1991 1065145 0% 901120 819200 81920 164025
27 1067136 83917 983219 7% 901120 819200 81920 82099
28 1067136 1949 1065187 0% 983040 819200 163840 82147
30 1067136 1991 1065145 0% 902400 819200 83200 162745
31 1067136 83917 983219 7% 902400 819200 83200 80819
As you can see, I got the same results on HotSpot 1.6 as 1.7.
Table of Contents
Heap Memory Area and Size Control
JVM Garbage Collection Logging
Introduction of Garbage Collectors
Serial Collector - "+XX:+UseSerialGC"
Parallel Collector - "+XX:+UseParallelGC"
Concurrent Mark-Sweep (CMS) Collector - "+XX:+UseConcMarkSweepGC"
Garbage First (G1) Collector - "+XX:+UseG1GC"
Object References and Garbage Collection
Garbage Collection Performance Test Program
Performance Tests on Serial Collector
Performance Tests on Parallel collector
Performance Tests on Concurrent collector
Performance Tests on G1 collector
Garbage Collection Performance Test Summary
Archived: GCTest2.java - Garbage Collection Test Program
Archived: 640/400/40MB Test on HotSpot Client 1.7
Archived: 640/400/40MB Test on HotSpot Client 1.6
Archived: 640/400/40MB Test on JRockit 28.2
Archived: 441/400/40MB Test on JRockit 28.2
Archived: 1076/800/80MB Test on HotSpot Client 1.7
►Archived: 1076/800/80MB Test on HotSpot Client 1.6