Footprint Saving with Restoring Shared Archive

This section provides a tutorial example on how to save footprint by restoring shared archive 'java -Xshare:on'.

To see the saving on footprint with restoring shared archive, I am planning to run LongSleep with and without the CDS feature. Here is my test results:

\j2sdk1.5.0\bin\java -cp . -Xshare:off LongSleep
 Free memory: 1879160
Total memory: 2031616
(Windows Task Manager shows: Mem Usage = 5340K)

\j2sdk1.5.0\bin\java -cp . -Xshare:on LongSleep
 Free memory: 1879152
Total memory: 2031616
(Windows Task Manager shows: Mem Usage = 6032K)

What a surprise! The CDS feature actually increased the footprint of LongSleep. Can anyone help to explain why?

Steve Bohne from the CDS implementation team at Sun.COM emailed in 2007 the following answer.

It is due to the memory accounting on Windows. Basically, Windows charges each process for the same shared data. My blog entry explains this further, and gives a more accurate measurement technique: http://blogs.sun.com/sbohne/entry/share_and_enjoy_memory_usage

Steve's blog says that Windows Task Manager report the total memory used by each process, including both the private portion and the shared portion. The CDS feature will increase the shared portion of each JVM process, which could not be reported by Window Task Manager. Other tools should be used to see the details of a JVM process memory usage.

Last update: 2007.

Table of Contents

 About This Book

 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

 Sun's JVM - Java HotSpot VM

 JRockit JVM 28.2.7 by Oracle Corporation

 JVM Runtime Data Areas

 Memory Management and Garbage Collectors

 Garbage Collection Tests

 JVM Stack, Frame and Stack Overflow

 Thread Testing Program and Result

 CPU Impact of Multi-Thread Applications

 I/O Impact of Multi-Thread Applications

CDS (Class Data Sharing)

 What Is Class Data Sharing?

 Regenerating Shared Archive

 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

 Micro Benchmark Tests on "float" and "double" Operations

 Outdated Tutorials

 References

 PDF Printing Version