Is every object rounded to the same size in Java?
According to this answer every object in Java is of the same size? Is the answer talking about the object itself or the reference to the object?
Here's the statement:
every object size is rounded to 16 bytes in Hotspot, so an object with a single byte field will take up precisely the same space as a single object with a long or double field;
I am completely baffled by the claim in this statement. So many upvotes to this answer further befuddled me.
Can some one please explain what is meant by the above statement?
According to this answer every object in Java is of the same size? Is the answer talking about the object itself or the reference to the object?
Here's the statement:
every object size is rounded to 16 bytes in Hotspot, so an object with a single byte field will take up precisely the same space as a single object with a long or double field;
I am completely baffled by the claim in this statement. So many upvotes to this answer further befuddled me.
Can some one please explain what is meant by the above statement?
No comments:
Post a Comment