Using JOL with JDK 9+181

Dmitry Vyazelenko vyazelenko at yahoo.com
Mon Sep 4 20:33:35 UTC 2017


Hi,

I'm trying to use JOL with the latest JDK 9 build:
java version "9"
Java(TM) SE Runtime Environment (build 9+181)
Java HotSpot(TM) 64-Bit Server VM (build 9+181, mixed mode)

But get tons of warnings when I try to run any of the JOL samples, e.g.:
/home/jdk-9/bin/java -classpath /home/projects/jol/jol-samples/target/classes:/home/projects/jol/jol-core/target/classes org.openjdk.jol.samples.JOLSample_01_Basic 
 
# WARNING: Unable to get Instrumentation. Dynamic Attach failed: null. You may add this JAR as -javaagent manually.
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.openjdk.jol.vm.sa.ServiceabilityAgentSupport (file:/home/dmitry/projects/oss/jol/jol-core/target/classes/) to field sun.management.RuntimeImpl.jvm
WARNING: Please consider reporting this to the maintainers of org.openjdk.jol.vm.sa.ServiceabilityAgentSupport
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
# Running 64-bit HotSpot VM.
# Using compressed oop with 3-bit shift.
# Using compressed klass with 3-bit shift.
# Objects are 8 bytes aligned.
# Field sizes by type: 4, 1, 1, 2, 2, 4, 4, 8, 8 [bytes]
# Array element sizes: 4, 1, 1, 2, 2, 4, 4, 8, 8 [bytes]

org.openjdk.jol.samples.JOLSample_01_Basic$A object internals:
 OFFSET  SIZE      TYPE DESCRIPTION                               VALUE
      0    12           (object header)                           N/A
     12     1   boolean A.f                                       N/A
     13     3           (loss due to the next object alignment)
Instance size: 16 bytes
Space losses: 0 bytes internal + 3 bytes external = 3 bytes total

Any idea on how to fix those?

Best regards, 
Dmitry Vyazelenko


More information about the jol-dev mailing list