Created
March 14, 2012 18:09
-
-
Save rednaxelafx/2038305 to your computer and use it in GitHub Desktop.
Getting the HeapOopSize through sun.misc.Unsafe. Refer to http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/2012-March/007445.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
D:\experiment>java -version | |
java version "1.6.0_30" | |
Java(TM) SE Runtime Environment (build 1.6.0_30-b12) | |
Java HotSpot(TM) 64-Bit Server VM (build 20.5-b03, mixed mode) | |
D:\experiment>groovysh | |
Groovy Shell (1.8.4, JVM: 1.6.0_30) | |
Type 'help' or '\h' for help. | |
--------------------------------------------------------------------------------------------------- | |
groovy:000> sun.misc.Unsafe.theUnsafe.arrayIndexScale(Object[].class) | |
===> 4 | |
groovy:000> sun.misc.Unsafe.theUnsafe.arrayBaseOffset(Object[].class) | |
===> 16 | |
groovy:000> quit | |
D:\experiment>set JAVA_OPTS=-XX:-UseCompressedOops | |
D:\experiment>groovysh | |
Groovy Shell (1.8.4, JVM: 1.6.0_30) | |
Type 'help' or '\h' for help. | |
--------------------------------------------------------------------------------------------------- | |
groovy:000> sun.misc.Unsafe.theUnsafe.arrayIndexScale(Object[].class) | |
===> 8 | |
groovy:000> sun.misc.Unsafe.theUnsafe.arrayBaseOffset(Object[].class) | |
===> 24 | |
groovy:000> quit | |
D:\experiment> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment