JVM Tutorials - Herong's Tutorial Examples - v5.13, by Herong Yang
Memory Footprint of JRockit R28.2.7
This section provides a tutorial example on how to check memory footprint of JRockit 6 R28.2.7 on Windows systems. JRockit has a much higher footprint than HotSpot.
The first thing I want to check on the JRockit JVM is the memory footprint of the virtual machine by using the following tutorial program:
/* LongSleep2.java * Copyright (c) 2013, HerongYang.com, All Rights Reserved. */ class LongSleep2 { public static void main(String[] a) { Runtime rt = Runtime.getRuntime(); System.out.println("Total memory: " + rt.totalMemory()); System.out.println(" Free memory: " + rt.freeMemory()); System.out.println(" Used memory: " + (rt.totalMemory()-rt.freeMemory())); try {Thread.sleep(1000*60*60);} catch (InterruptedException e) {} } }
Compile and run it on JRockit R28.2.7, I got this output:
>\Progra~1\java\jrockit-jdk1.6.0_45-R28.2.7-4.1.0\bin\javac \ LongSleep2.java >\Progra~1\java\jrockit-jdk1.6.0_45-R28.2.7-4.1.0\bin\java LongSleep2 Total memory: 67108864 Free memory: 63434800 Used memory: 3674064
As a comparison, compile and run the same program on HotSpot (JDK) 1.6.0 in another command window:
>\Progra~1\java\jdk1.6.0_45\bin\javac LongSleep2.java >\Progra~1\java\jdk1.6.0_45\bin\java LongSleep2.java Total memory: 16252928 Free memory: 15965056 Used memory: 287872
Now run the same program again on HotSpot (JDK) 1.6.0 in "Server" mode in a third command window:
>\Progra~1\java\jdk1.6.0_45\bin\java -server LongSleep2.java Total memory: 54919168 Free memory: 54632104 Used memory: 287064
The output shows that JRockit R28.2.7 has a much bigger footprint, 3,674KB, comparing to 287KB used by HotSpot 1.6.0.
While all 3 JVM instances are running, we can also compare their memory usages reported by the system Task Manager:
Task Manager Run Time Environment JVM Memory Total Free Used -------------- ------------ ------- ------- ------ JRockit 16,780K 67,108K 63,434K 3,674K HotSpot Client 3,488K 16,252K 15,965K 287K HotSpot Server 3,776K 54,919K 54,632K 287K
It is interesting to see that the Task Manager reports much less message sizes than Runtime class methods. But it still also confirming that JRockit has a much bigger footprint comparing to HotSpot.
Table of Contents
JVM (Java Virtual Machine) Specification
Java HotSpot VM - JVM by Oracle/Sun
java.lang.Runtime Class - The JVM Instance
java.lang.System Class - The Operating System
ClassLoader Class - Class Loaders
Class Class - Class Reflections
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
Micro Benchmark Tests on "float" and "double" Operations
►JRockit JVM 28.2.7 by Oracle Corporation
Downloading and Installing JRockit R28.2.7
Running Java Programs on JRockit R28.2.7
►Memory Footprint of JRockit R28.2.7
What Is JRockit Mission Control?
Running JRockit Mission Control
What JRockit Management Console