JVM Tutorials - Herong's Tutorial Examples - Version 4.23, by Dr. Herong Yang
Viewing Shared Memory of JVM Processes
This section provides a tutorial example on how to view shared memory among JVM processes using vadump.exe.
As suggested by Steve Bohne from Sun.COM, if you want to see the shared memory usage of JVM processes, you should install vadump.exe from Microsoft.
vadump.exe is a command line tool that shows very detailed information of a running process on a Windows system. There are 3 options you need to use with vadump.exe to get the private memory and shared memory usages:
With vadump.exe and tasklist.exe ready, let's see how much memory will be shared by multiple JVM processes with CDS turned off:
(Open first command window) C:\>\progra~1\java\jdk1.6.0_02\bin\java -cp . -Xshare:off LongSleep Free memory: 4997088 Total memory: 5177344 (Open second command window) C:\>\progra~1\java\jdk1.6.0_02\bin\java -cp . -Xshare:off LongSleep Free memory: 4997088 Total memory: 5177344 (Open third command window) C:\>tasklist Image Name PID Session Name Session# Mem Usage ============= ====== ============ ======== ========= ... java.exe 2312 0 6,580 K java.exe 3920 0 6,548 K (tasklist.exe reports the total memory usage in the same way as Windows Task Manager) C:\>\progra~1\resour~1\vadump -o -s -p 2312 Category Total Private Shareable Shared Pages KBytes KBytes KBytes KBytes ... Total Modules 794 3176 300 0 2876 Total Dynamic Data 816 3264 3120 4 140 Total System 45 180 180 0 0 Grand Total Working Set 1655 6620 3600 4 3016 C:\>\progra~1\resour~1\vadump -o -s -p 3920 Category Total Private Shareable Shared Pages KBytes KBytes KBytes KBytes ... Total Modules 794 3176 300 0 2876 Total Dynamic Data 804 3216 3088 4 124 Total System 49 196 196 0 0 Grand Total Working Set 1647 6588 3584 4 3000
Now we know that:
Now let's repeat the same test with CDS turned on:
(Open first command window) C:\>\progra~1\java\jdk1.6.0_02\bin\java -cp . -Xshare:on LongSleep Free memory: 4997088 Total memory: 5177344 (Open second command window) C:\>\progra~1\java\jdk1.6.0_02\bin\java -cp . -Xshare:on LongSleep Free memory: 4997088 Total memory: 5177344 (Open third command window) C:\>tasklist Image Name PID Session Name Session# Mem Usage ============= ====== ============ ======== ========= ... java.exe 1772 0 7,032 K java.exe 420 0 7,032 K (tasklist.exe reports the total memory usage in the same way as Windows Task Manager) C:\>\progra~1\resour~1\vadump -o -s -p 1772 Category Total Private Shareable Shared Pages KBytes KBytes KBytes KBytes ... Total Modules 784 3136 300 0 2836 Total Dynamic Data 925 3700 2124 4 1572 Total System 59 236 236 0 0 Grand Total Working Set 1768 7072 2660 4 4408 C:\>\progra~1\resour~1\vadump -o -s -p 420 Category Total Private Shareable Shared Pages KBytes KBytes KBytes KBytes ... Total Modules 784 3136 300 0 2836 Total Dynamic Data 925 3700 2124 4 1572 Total System 59 236 236 0 0 Grand Total Working Set 1768 7072 2660 4 4408
Comparing with CDS turned off, the results show that:
Last update: 2007.
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
JVM Stack, Frame and Stack Overflow
Thread Testing Program and Result
CPU Impact of Multi-Thread Applications
I/O Impact of Multi-Thread Applications
Startup Time Saving with Restoring Shared Archive
Startup Time Saving with Multiple JVM Processes
Footprint Saving with Restoring Shared Archive
►Viewing Shared Memory of JVM Processes
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