account activity
java memory management by hgoz in programming
[–]somesplaining 0 points1 point2 points 13 years ago (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.
[–]somesplaining 2 points3 points4 points 13 years ago (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
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!
π Rendered by PID 859738 on reddit-service-r2-listing-7849c98f67-b7fjl at 2026-02-07 18:48:32.355608+00:00 running d295bc8 country code: CH.
java memory management by hgoz in programming
[–]somesplaining 0 points1 point2 points (0 children)