Object Layout And Footprint

Sizing a data structure in bytes before it exists. Use when a shape is chosen for millions of instances — record, class, primitive array, parallel arrays or boxed collection; when an array is proposed to save the header; when HashMap<Integer,Integer> or List<Long> is on a bulk path; when -XX:+UseCompactObjectHeaders is evaluated for footprint; or when smaller objects are expected to buy shorter GC pauses without a collector-specific measurement. Answers in bytes per element; one record-versus-array example reverses under the JDK 27 default (JEP 534, not yet GA). Sizing a replacement belongs here; measuring what exists is heap-dump-analysis. Not flag lifecycle (jvm-performance-review), @Contended padding (false-sharing-and-contended), cache hierarchy (cpu-cache-and-numa), allocation rate (allocation-profiling), container budget (jvm-memory-regions), compressed class space (metaspace-internals), off-heap memory (off-heap-memory), or sharing duplicates (gof-flyweight).

robsonkades Updated

File contents

robsonkades/agent-skills/tree/main/skills/object-layout-and-footprint commit 032d02ad67

Frequently asked questions

npx skillmds@latest add robsonkades/object-layout-and-footprint