Questions tagged [jol]

Java Object Layout is a project within the OpenJDK to determine the memory layout of instances on the HotSpot virtual machine.

Java Object Layout is a project within the OpenJDK to determine the memory layout of instances on the HotSpot virtual machine.

Webpage: http://openjdk.java.net/projects/code-tools/jol/

20 questions
49
votes
3 answers

What is in Java object header?

Could you give me some information on what is exactly stored in object header? I know, that it's probably JVM dependent, but maybe for HotSpot at least? I'm looking for exact description specifically for a first row. I've read several information…
alobodzk
  • 1,224
  • 1
  • 12
  • 25
21
votes
1 answer

How are Java objects laid out in memory on Android?

I'm fairly familiar with the layout of objects on the heap in HotSpot, but not so much for Android. For example, in a 32-bit HotSpot JVM, an object on the heap is implemented as an 8-byte header, followed by the object's fields (one byte for…
Louis Wasserman
  • 172,699
  • 23
  • 307
  • 375
9
votes
1 answer

Java primitive array layout in memory

Here are the two samples I would like to base my question on (assuming you have JOL here): Layouter layout32Bits = new HotSpotLayouter(new X86_32_DataModel()); Layouter layout64BitsComp = new HotSpotLayouter(new X86_64_COOPS_DataModel()); And an…
Eugene
  • 102,901
  • 10
  • 149
  • 252
7
votes
2 answers

Why is there internal fragmentation in a Java object even if every field is 4-byte aligned?

Intro: I used the JOL (Java Object Layout) tool to analyze the internal and external fragmentation of Java objects for research purpose. While doing so, I stumbled across the following: x@pc:~/Util$ java -jar jol-cli-0.9-full.jar internals…
Markus Weninger
  • 8,844
  • 4
  • 47
  • 112
7
votes
1 answer

Is jol a little broken under Java9?

Using java-9 build 9-ea+149 and jol 0.6. Running this simple code: ArrayList list = new ArrayList<>(); list.add(12); System.out.println(ClassLayout.parseInstance(list).toPrintable()); Output: OFFSET SIZE TYPE DESCRIPTION …
Eugene
  • 102,901
  • 10
  • 149
  • 252
6
votes
1 answer

How to run jol on Java 9?

I'm trying to run a program using jol with Java 9 but with no luck. I have the following dependency in pom.xml: org.openjdk.jol jol-core 0.9 The…
ZhekaKozlov
  • 29,055
  • 16
  • 100
  • 138
5
votes
1 answer

What is "(something else)" in jol GraphLayout output?

When using jol's GraphLayout class to print the graph of objects referenced from an object instance, some of the output entries say "(something else)" instead of a type and reference path. For example, consider the following code that prints the…
Jeffrey Bosboom
  • 12,141
  • 16
  • 70
  • 85
4
votes
1 answer

UseCompressedOops UseCompressedClassPointers in jdk-13 and jdk-15

Accidentally I have stumbled into a change in jdk-15 that I was not aware of. Suppose I have a very simple question: what is the size of an array of 3 intergers? For this, I use JOL. The code is fairly trivial: import…
Eugene
  • 102,901
  • 10
  • 149
  • 252
4
votes
1 answer

Why does the object call toString() affect the output of the object header? I am using the jol package

L's code is very simple public class L { } public class Synchronized1 { public static void main(String[] args) { L l=new L(); // System.out.println(l.toString()); …
dengshuo
  • 49
  • 4
3
votes
1 answer

java.lang.Integer object layout and it's overhead

I used a tool called JOL (Java Object Layout) which tries to analyze object layout. It comes with a cli and I used it to analyze java.lang.Integer. I see that Integer object is taking 12 extra bytes for overhead. That overhead can be 4 bytes for the…
Node.JS
  • 1,849
  • 3
  • 28
  • 86
3
votes
1 answer

Java object layout and static fields

The JOL tool gives ability to count object's memory layout. I've noticed, that static fields do not participate in calculating, for example: public class Foo { private static final int i = 1; private char value; public Foo(char value)…
Vladimir Kishlaly
  • 1,752
  • 1
  • 15
  • 24
3
votes
1 answer

How to interpret an instance's mark word?

I am trying to make sense of the output of Java object layout on a 64-bit HotSpot VM (v8). I do not understand how the first three bit of the mark word are used which according to the commentary in the linked class file should indicated weather a…
Rafael Winterhalter
  • 38,221
  • 13
  • 94
  • 174
2
votes
2 answers

Why VisualVm and JOL tools give different results for object size

I've tried to measure size of one instance of the class A: package pkg; class A { private int i; } Result using VisualVm was 20 bytes: But result using JOL was 16 bytes: pkg.A object internals: OFFSET SIZE TYPE DESCRIPTION …
Artem Petrov
  • 662
  • 4
  • 12
2
votes
1 answer

jol footprint of HashMap

I have a problem with objects footprint understanding: I'm running the following lines in two cases A and B out.println(VM.current().details()); HashMap hashMap = new HashMap<>(); A: for (int i = 0; i < 1000; i++) { …
Sergei Rybalkin
  • 2,890
  • 11
  • 24
2
votes
1 answer

Is jol missing the main property in the MANIFEST file?

I'm trying to use jol, from openJDK. I downloaded the jar from here: http://central.maven.org/maven2/org/openjdk/jol/jol-cli/0.4/jol-cli-0.4.jar However, when I try to run with: java -jar jol-cli-0.4.jar --help I get: no main manifest attribute,…
Roberto Attias
  • 1,858
  • 1
  • 8
  • 17
1
2