JVM Tutorials - Herong's Tutorial Examples - Version 4.23, by Dr. Herong Yang
1076/800/80MB Test on HotSpot Client 1.7
This chapter provides tutorial notes and example codes on garbage collection. Topics include garbage collection test program - GCTest2.java; comparisons between HotSpot 1.7.0, HotSpot 1.6.0 and JRockit R28.2.7.
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.
Last update: 2014.
Table of Contents
Downloading and Installing JDK 1.8.0 on Windows
Downloading and Installing JDK 1.7.0 on Windows
java.lang.Runtime Class - The JVM Instance
java.lang.System Class - The Operating System
ClassLoader Class - Class Loaders
Class Class - Class Reflections
JRockit JVM 28.2.7 by Oracle Corporation
Memory Management and Garbage Collectors
GCTest2.java - Garbage Collection Test Program
640/400/40MB Test on HotSpot Client 1.7
640/400/40MB Test on HotSpot Client 1.6
640/400/40MB Test on JRockit 28.2
441/400/40MB Test on JRockit 28.2
►1076/800/80MB Test on HotSpot Client 1.7
1076/800/80MB Test on HotSpot Client 1.6
1076/800/80MB Test on JRockit 28.2
JVM Stack, Frame and Stack Overflow
Thread Testing Program and Result
CPU Impact of Multi-Thread Applications
I/O Impact of Multi-Thread Applications
Micro Benchmark Runner and JVM Options
Micro Benchmark Tests on "int" Operations
Micro Benchmark Tests on "long" Operations
Micro Benchmark Tests in JIT Compilation Mode