JVM Tutorials - Herong's Tutorial Examples - Version 4.23, by Dr. Herong Yang
640/400/40MB 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 640MB memory limit and a 400MB base plus 40MB 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:
>\Progra~1\java\jdk1.6.0_45\bin\javac GCTest2.java
>\Progra~1\java\jdk1.6.0_45\bin\java -Xmx640m GCTest2
Test parameters:
Object size: 1280KB
Initial objects and data size: 320, 409600KB
Added objects and data size: 32, 40960KB
Time Total Free Used Free Total Act. Dead Over
sec. Mem. Mem. Mem. %. Obj. Obj. Obj. Head
1 633536 182807 450729 28% 450560 409600 40960 169
2 633536 141849 491687 22% 450560 409600 40960 41127
3 633536 100888 532648 15% 491520 409600 81920 41128
4 633536 59928 573608 9% 532480 409600 122880 41128
5 633536 18967 614569 2% 573440 409600 163840 41129
7 633536 7448 626088 1% 450560 409600 40960 175528
8 633536 141860 491676 22% 450560 409600 40960 41116
9 633536 100900 532636 15% 491520 409600 81920 41116
10 633536 59939 573597 9% 532480 409600 122880 41117
11 633536 18971 614565 2% 573440 409600 163840 41125
12 633536 18976 614560 2% 450560 409600 40960 164000
13 633536 141864 491672 22% 450560 409600 40960 41112
14 633536 100900 532636 15% 491520 409600 81920 41116
15 633536 59940 573596 9% 532480 409600 122880 41116
16 633536 18976 614560 2% 573440 409600 163840 41120
18 633536 18979 614557 2% 450560 409600 40960 163997
19 633536 141866 491670 22% 450560 409600 40960 41110
20 633536 100903 532633 15% 491520 409600 81920 41113
21 633536 59939 573597 9% 532480 409600 122880 41117
22 633536 18976 614560 2% 573440 409600 163840 41120
23 633536 182827 450709 28% 450560 409600 40960 149
24 633536 141865 491671 22% 491520 409600 81920 151
25 633536 100902 532634 15% 532480 409600 122880 154
26 633536 59938 573598 9% 573440 409600 163840 158
27 633536 18975 614561 2% 614400 409600 204800 161
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)
Conclusion, HotSpot Client JVM 1.7.0_45 requires more than 640MB to run a program that has a 400MB base memory usage plus 40MB fluctuating memory usage with object size of 1.25MB. Basically, the JVM requires more than 200MB to manage dead objects and other system tasks.
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