As Java developers, we're always curious about the memory footprint of our java objects.
In this video we'll see how Java objects are structured in heap memory, the amount of memory they consume, and how the OpenJDK HotSpot JVM uses a 32-bit pointer to represent 64-bit memory addresses.
The output of the JOL library may differ in versions prior to JDK 15.
jdk used: openjdk 21
doc link: / java-hotspot-jvm-object-layout
Code: https://github.com/0equalsto1/JForJava
https://github.com/openjdk/jdk21u/blo...
https://github.com/openjdk/jdk21u/blo...
https://github.com/openjdk/jdk21u/blo...
https://github.com/openjdk/jdk21u/tre...
https://docs.oracle.com/en/java/javas...
https://github.com/openjdk/jol
https://github.com/openjdk/jol/tree/m...
https://shipilev.net/jvm/objects-insi...
Project Lilliput:
https://openjdk.org/jeps/450
https://wiki.openjdk.org/display/lill...
list of all -XX JVM options:
-XX:+PrintFlagsFinal
https://docs.oracle.com/en/java/javas...
-XX:ObjectAlignmentInBytes=alignment
Enables or disable the use of compressed pointers (object references represented as 32
bit offsets instead of 64-bit pointers) for optimized 64-bit performance with Java heap sizes less than 32gb.
-XX:-UseCompressedOops (disable) -XX:+UseCompressedOops enable
Auf dieser Seite können Sie das Online-Video Java Object Layout | Ordinary Object Pointer | Object Header | CompressedOops | OpenJdk HotSpot JVM mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer 0equalsTo1 01 Januar 1970 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 582 Mal angesehen und es wurde von 20 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!