Skip to main content

Object Layout & JOL Memory Inspection

Using the Java Object Layout (JOL) tool, Helix inspects the exact physical memory structure and 8-byte word alignment of runtime objects under 64-bit JVM Compressed OOPs (-XX:+UseCompressedOops).


64-Bit Object Header Structure​

Every Java object in memory has an object header followed by its instance payload fields and alignment padding:

Mark Word (8 Bytes)Klass Pointer (4 Bytes)Object Payload Fields (Var Bytes)Alignment Padding (0-7 Bytes)Lock state, GC age, hashcode-XX:+UseCompressedClassPointersPrimitives, 4B compressed OOP refs8-byte word boundary alignment

Helix Object Footprint Analysis​

Class SymbolShallow SizeRetained Deep SizeField & Padding Layout Breakdown
ExecutionResult32 Bytes64 Bytes12B Header + 1B success + 4B result + 4B error + 8B nanos + 3B padding
ExecutionContext24 Bytes256 Bytes12B Header + 4B variables Map reference + 8B padding
CacheKey32 Bytes184 Bytes12B Header + 4B name + 4B version + 4B schema + 8B hashcode
RuleClassLoader112 Bytes12.4 KB12B Header + ClassLoader native vector structures + loaded class references
CompiledRuleClass640 Bytes (ASM)2.4 KB (Metaspace)Bytecode instructions array + constant pool + class metadata

Running Layout Inspection​

./scripts/run-experiment.sh layout
[INFO] Analyzed object layout for 'com.helix.api.ExecutionResult':
- Object Header: 12 Bytes (8B Mark Word + 4B Klass Pointer)
- Instance Data: 17 Bytes
- Word Alignment: 3 Bytes Padding
- Shallow Size: 32 Bytes