Estimate the memory footprint of objects including headers, fields and alignment padding.
Every object carries a runtime header and is padded to an alignment boundary, so small objects waste proportionally more memory. Millions of small objects can spend more memory on headers than on data. This overhead is why struct-of-arrays layouts outperform arrays-of-objects for large datasets, both in memory and in cache behaviour.
Object Memory
Bytes per object = ⌈(header + fields) ÷ alignment⌉ × alignment
Bytes per object = ⌈(header + fields) ÷ alignment⌉ × alignment Every object carries a runtime header and is padded to an alignment boundary, so small objects waste proportionally more memory. Millions of small objects can spend more memory on headers than on data.
This overhead is why struct-of-arrays layouts outperform arrays-of-objects for large datasets, both in memory and in cache behaviour.
This calculator takes 5 inputs: Number of objects, Fields per object, Average bytes per field, Object header size, Alignment boundary. The pre-filled defaults are a realistic starting point — replace them with figures from your own environment for a result you can act on.