Java 8 GC Tutorials - Herong's Tutorial Examples - v1.02, by Dr. Herong Yang
Outdated: 1076/800/80MB Test on HotSpot Client 1.7
This section provides a tutorial example on running GCTest2.java on HotSpot Client JVM 1.7.0_45 with 1076MB memory limit and a 800MB base plus 80MB fluctuating memory usage with object size of 1.25MB. It crashed almost immediately.
For the next round of tests, I want to increase the memory usage of my test program to see the impact of JVM.
In the first test, I raised the base and fluctuating memory usages to 800MB and 80MB with 1.7.0_45 on my Windows 7 system which has about 1700 available physical memory.
>\Progra~1\java\jdk1.7.0_45\bin\javac GCTest2.java >\Progra~1\java\jdk1.7.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 163740 901412 15% 901120 819200 81920 292 2 1065152 81819 983333 7% 983040 819200 163840 293 3 1065152 163744 901408 15% 901120 819200 81920 288 5 1065152 81823 983329 7% 983040 819200 163840 289 Exception in thread "main" java.lang.OutOfMemoryError: Java heap space at GCTest2$MyObject.<init>(GCTest2.java:70) at GCTest2.myTest(GCTest2.java:37) at GCTest2.main(GCTest2.java:22)
Too bad. HotSpot Client 1.7.0_45 crashed almost immediately, with -Xmx1076m.
However, when I added 1MB to the total memory, -Xmx1077m, the JVM was able to continue without any issues:
>\Progra~1\java\jdk1.7.0_45\bin\javac GCTest2.java >\Progra~1\java\jdk1.7.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 165724 901412 15% 901120 819200 81920 292 2 1067136 83803 983333 7% 983040 819200 163840 293 3 1067136 1877 1065259 0% 901120 819200 81920 164139 4 1067136 83807 983329 7% 901120 819200 81920 82209 5 1067136 1886 1065250 0% 983040 819200 163840 82210 7 1067136 1886 1065250 0% 901120 819200 81920 164130 8 1067136 83808 983328 7% 901120 819200 81920 82208 9 1067136 1886 1065250 0% 983040 819200 163840 82210 10 1067136 1888 1065248 0% 901120 819200 81920 164128 12 1067136 83810 983326 7% 901120 819200 81920 82206 13 1067136 1886 1065250 0% 983040 819200 163840 82210 14 1067136 1887 1065249 0% 901120 819200 81920 164129 15 1067136 83803 983333 7% 901120 819200 81920 82213 16 1067136 1876 1065260 0% 983040 819200 163840 82220 18 1067136 1873 1065263 0% 901120 819200 81920 164143 19 1067136 83810 983326 7% 901120 819200 81920 82206 20 1067136 1841 1065295 0% 983040 819200 163840 82255 22 1067136 1884 1065252 0% 902400 819200 83200 162852 23 1067136 83810 983326 7% 902400 819200 83200 80926 24 1067136 1842 1065294 0% 984320 819200 165120 80974 25 1067136 1884 1065252 0% 902400 819200 83200 162852 27 1067136 83810 983326 7% 902400 819200 83200 80926 28 1067136 1842 1065294 0% 984320 819200 165120 80974 29 1067136 1884 1065252 0% 902400 819200 83200 162852 30 1067136 77921 989215 7% 902400 819200 83200 86815 32 1067136 83811 983325 7% 902400 819200 83200 80925 33 1067136 1884 1065252 0% 984320 819200 165120 80932 34 1067136 1884 1065252 0% 902400 819200 83200 162852 35 1067136 83810 983326 7% 902400 819200 83200 80926 36 1067136 1841 1065295 0% 984320 819200 165120 80975 38 1067136 1884 1065252 0% 902400 819200 83200 162852 39 1067136 83810 983326 7% 902400 819200 83200 80926 40 1067136 1842 1065294 0% 984320 819200 165120 80974 41 1067136 1884 1065252 0% 902400 819200 83200 162852 43 1067136 83810 983326 7% 902400 819200 83200 80926 44 1067136 1842 1065294 0% 984320 819200 165120 80974 45 1067136 1884 1065252 0% 902400 819200 83200 162852 47 1067136 73568 993568 6% 902400 819200 83200 91168 48 1067136 83811 983325 7% 902400 819200 83200 80925 49 1067136 1882 1065254 0% 984320 819200 165120 80934 50 1067136 1884 1065252 0% 902400 819200 83200 162852 ... 267 1067136 83820 983316 7% 906240 819200 87040 77076 268 1067136 1851 1065285 0% 988160 819200 168960 77125 270 1067136 1893 1065243 0% 906240 819200 87040 159003
Conclusion, HotSpot Client JVM 1.7.0_45 requires more than 1076MB to run a program that has a 800MB base memory usage plus 80MB fluctuating memory usage with object size of 1.25MB.
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
Outdated: GCTest2.java - Garbage Collection Test Program
Outdated: 640/400/40MB Test on HotSpot Client 1.7
Outdated: 640/400/40MB Test on HotSpot Client 1.6
Outdated: 640/400/40MB Test on JRockit 28.2
Outdated: 441/400/40MB Test on JRockit 28.2
►Outdated: 1076/800/80MB Test on HotSpot Client 1.7
Outdated: 1076/800/80MB Test on HotSpot Client 1.6