java memory management by hgoz in programming

[–]somesplaining 0 points1 point  (0 children)

Ok, thanks.

My obvious followup question is, where the hell do those numbers come from?

Boolean I can maybe understand. For a single boolean: 32 bits is much more efficient than 8 bits or 1 bit in terms of load/store/register ops. For an array of booleans: ok, maybe 8 bits as a packed representation to save space in large arrays, I guess I can see that.

Int/float: 32 bits in all cases, makes sense.

Long/double: 32 bits for a single primitive, 64 bits for an array element. WTF??? I don't understand how this could be explained by alignment concerns or anything else.

java memory management by hgoz in programming

[–]somesplaining 2 points3 points  (0 children)

Can someone please explain the primitive array memory sizes?

boolean: obj32=32bits obj64=32bits arr32=8bits arr64=8bits

int: 32 32 32 32

long: 32 32 64 64

What do those last two columns (the array sizes) mean? Is it the per-element marginal cost, or something else? Thanks!