Created
May 5, 2014 11:32
-
-
Save shipilev/e43a27851a4ce985ac48 to your computer and use it in GitHub Desktop.
Adding String.dummy
This file contains hidden or 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
$ bin/java -jar ~/projects/jol/jol-cli/target/jol-internals.jar java.lang.String | |
Running 64-bit HotSpot VM. | |
Using compressed references 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] | |
java.lang.String object internals: | |
OFFSET SIZE TYPE DESCRIPTION VALUE | |
0 4 (object header) 01 00 00 00 (0000 0001 0000 0000 0000 0000 0000 0000) | |
4 4 (object header) 00 00 00 00 (0000 0000 0000 0000 0000 0000 0000 0000) | |
8 4 (object header) db 02 00 f8 (1101 1011 0000 0010 0000 0000 1111 1000) | |
12 4 char[] String.value [] | |
16 4 int String.hash 0 | |
20 1 boolean String.dummy false | |
21 3 (loss due to the next object alignment) | |
Instance size: 24 bytes (estimated, add this JAR via -javaagent: to get accurate result) | |
Space losses: 0 bytes internal + 3 bytes external = 3 bytes total | |
$ bin/java -version | |
openjdk version "1.8.0-internal-fastdebug" | |
OpenJDK Runtime Environment (build 1.8.0-internal-fastdebug-jenkins_2014_05_05_06_18-b00) | |
OpenJDK 64-Bit Server VM (build 25.0-b70-fastdebug, mixed mode) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment