Class CompactObjectHeadersExamples
java.lang.Object
net.jrodolfo.java_evolution.java25.compact_object_headers.CompactObjectHeadersExamples
Demonstrates the Java 25 Compact Object Headers runtime option.
Compact object headers are JVM implementation details, so this example does
not try to measure object sizes. Instead, it launches a child JVM and verifies
the executable part that is faithful and portable: Java 25 accepts
-XX:+UseCompactObjectHeaders as a product flag, and
-XX:+PrintFlagsFinal reports the flag state selected on the command
line.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordA JVM flag state reported by-XX:+PrintFlagsFinal. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReads the compact-object-headers VM flag after disabling it explicitly.Reads the compact-object-headers VM flag after enabling it explicitly.Explains the executable boundary of this example.Explains why memory savings are not asserted in the unit test.
-
Constructor Details
-
CompactObjectHeadersExamples
public CompactObjectHeadersExamples()
-
-
Method Details
-
enabledFlagState
public CompactObjectHeadersExamples.VmFlagState enabledFlagState() throws IOException, InterruptedExceptionReads the compact-object-headers VM flag after enabling it explicitly.- Returns:
- the VM-reported flag state
- Throws:
IOException- if the child JVM cannot be startedInterruptedException- if interrupted while waiting for the child JVM
-
disabledFlagState
public CompactObjectHeadersExamples.VmFlagState disabledFlagState() throws IOException, InterruptedExceptionReads the compact-object-headers VM flag after disabling it explicitly.- Returns:
- the VM-reported flag state
- Throws:
IOException- if the child JVM cannot be startedInterruptedException- if interrupted while waiting for the child JVM
-
executableBoundary
Explains the executable boundary of this example.- Returns:
- a short explanation
-
measurementCaution
Explains why memory savings are not asserted in the unit test.- Returns:
- a short explanation
-