NMT does not show virtual memory reservations with "java -version"?

Christian Törnqvist christian.tornqvist at oracle.com
Thu Mar 7 02:36:47 PST 2013


Hi Thomas,

The problem here is the that all data is not guaranteed to be merged and visible when you print the report, it's the same for the jcmd commands. 

Thanks,
Christian

-----Original Message-----
From: Thomas Schatzl 
Sent: den 7 mars 2013 10:43
To: hotspot-runtime-dev at openjdk.java.net
Subject: NMT does not show virtual memory reservations with "java -version"?

Hi,

  I am currently trying to use NMT to track virtual memory usage of the VM; when running

../bin/java -XX:NativeMemoryTracking=summary -XX:+PrintNMTStatistics -version

the output is

openjdk version "1.8.0-internal"
OpenJDK Runtime Environment (build
1.8.0-internal-thomas_2013_02_28_14_08-b00)
Java HotSpot(TM) 64-Bit Server VM (build 25.0-b21-internal-jvmg, mixed
mode)
 
Native Memory Tracking:
 
Total:  reserved=0KB,  committed=0KB


Which seemed odd to me because even for the -version arguments I doubt that the VM uses or reserves absolutely no memory.

So I added some log messages in
MemTracker::record_virtual_memory_reserve() so that it looks as follows:

static inline void record_virtual_memory_reserve(address addr, size_t size, address pc = 0, Thread* thread = NULL) {

  gclog_or_tty->print("reserve virt mem at "PTR_FORMAT" size %zd\n", addr, size / K);
  if (is_on()) {
[...]

When running this augmented VM (recent hsx25 btw, 64 bit VM, Linux) with the same arguments it prints the following:

reserve virt mem at 0x00007f8743fed000 size 32 reserve virt mem at 0x00007f874046b000 size 8192 reserve virt mem at 0x00007f8739000000 size 49152 reserve virt mem at 0x00007f8743f2d000 size 768 reserve virt mem at 0x00000000cbe00000 size 854016
   ^-- this is the java heap btw
reserve virt mem at 0x00007f87402fb000 size 1472 reserve virt mem at 0x00007f8740206000 size 980 reserve virt mem at 0x00007f873770e000 size 23488 reserve virt mem at 0x00007f8736d05000 size 10276 openjdk version "1.8.0-internal"
OpenJDK Runtime Environment (build
1.8.0-internal-thomas_2013_02_28_14_08-b00)
Java HotSpot(TM) 64-Bit Server VM (build 25.0-b21-internal-jvmg, mixed
mode)
 
Native Memory Tracking:
 
Total:  reserved=0KB,  committed=0KB

What am I doing wrong that these virtual memory reservations do not show up in NMT?

This is roughly a GB of reservations that seem to be missing.

Thanks,
Thomas



More information about the hotspot-runtime-dev mailing list