|
Java HotSpot VM
Part:
1
2
(Continued from previous part...)
Running Java HotSpot Server VM
The following notes were taken in 2007.
After installing JDK 6u2, the Java HotSpot Server VM should be available on my machine.
To verify this, run the following command
in a command window:
C:\>\progra~1\java\jdk1.6.0_02\bin\java -server -version
java version "1.6.0_02"
Java(TM) SE Runtime Environment (build 1.6.0_02-b06)
Java HotSpot(TM) Server VM (build 1.6.0_02-b06, mixed mode)
The last line of the output tells you that the Java HotSpot Server VM installed ok.
And you have to use the "-server" option to invoke it.
The following notes were taken in 2004.
I have just downloaded and installed j2sdk1.4.0_02 on my machine, so the Java HotSpot
Server VM should be available on my machine. To verify this, run the following command
in a command window:
\local\j2sdk1.4.0_02\bin\java -server -version
Output
java version "1.4.0_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0_02-b02)
Java HotSpot(TM) Server VM (build 1.4.0_02-b02, mixed mode)
The last line of the output tells you that the Java HotSpot Server VM installed ok.
And you have to use the -server option to invoke it.
VM Memory Usages
Let's use the following simple program to see the memorry usages of the Java
HotSpot VM:
class LongWhile {
public static void main(String[] a) {
Runtime rt = Runtime.getRuntime();
System.out.println(" Free memory: " + rt.freeMemory());
System.out.println("Total memory: " + rt.totalMemory());
while (true);
}
}
The following notes were taken in 2007 on a Windows XP system.
This program was compiled with JDK 6u2, and executed in two command windows:
one with the Client VM, and the other with the Server VM. They both reported the
same amount total memory and free memory in the run time environment,
as shown in the table below:
C:\>\progra~1\java\jdk1.6.0_02\bin\java LongWhile
Free memory: 4997088
Total memory: 5177344
C:\>\progra~1\java\jdk1.6.0_02\bin\java -server LongWhile
Free memory: 4997088
Total memory: 5177344
So the JVM itself used about 5177344 - 4997088 = 180256 bytes for both client and server versions.
Comparing with notes taken on JDK 1.4.0, JDK 6 seems to have smaller footprint 252240 - 180256 = 71984 bytes.
While the two programs were running, I also used the Windows XP Task Manager
to look at them from the operating system point of view. The Task Manager reported
a 6K less memory usage in the Server VM. See the table bellow for details:
Task Manager Run Time Environment
JVM Memory CPU Free Total
Client VM 6996K 50% 4997088 5177344
Server VM 6990K 50% 4997088 5177344
The following notes were taken in 2004 on a Windows 2000 system.
This program was compiled with j2sdk1.4.0_02, and executed in two command windows:
one with the Client VM, and the other with the Server VM. They both reported the
same amount total memory in the run time environment. But the Server VM gives 248
bytes less free memory.
While the two programs were running, I also used the Windows 2000 Task Manager
to look at them from the operating system point of view. The Task Manager reported
a 676K more memory usage in the Server VM.
See the table bellow for details:
Task Manager Run Time Environment
JVM Memory CPU Free Total Used
Client VM 4576K 50% 1779376 2031616 252240
Server VM 5252K 50% 1779128 2031616 252488
Part:
1
2
|