The Immutability Analysis is a dynamic analysis that records which of an object’s fields are effectively immutable and whether zeroing them was redundant due to explicit initialization. For this purpose, the analysis considers an object uninitialized until its constructor has finishes execution. Arrays are ignored by the Immutability Analysis, as they don’t allow for a clear‐cut definition of initialization; they lack a constructor.

Sample Profile

The format of the profile is record‐oriented; each object on the heap corresponds to one multi‐line record in the produced profile.

Below is an excerpt from a real‐world profile:

java/lang/StringBuffer␜toString␜()Ljava/lang/String;␜1	java.lang.String
java.lang.String␜hash␜I	false	true
java.lang.String␜count␜I	false	false
java.lang.String␜offset␜I	false	false
java.lang.String␜value␜[C	false	false

java/util/regex/Matcher␜replaceAll␜(Ljava/lang/String;)Ljava/lang/String;␜9	java.lang.StringBuffer
java.lang.AbstractStringBuilder␜count␜I	true	true
java.lang.AbstractStringBuilder␜value␜[C	false	false

The first line of each record identifies an object’s allocation site and type in the first and second column, respectively. The allocation site is described by a quadruple of class name, method name, method descriptor, and the index of the instruction (new, newarray, anewarray, multianewarray) that performed the allocation. The four components are separated by the “File Separator” control character ('\034'). And instruction index of −1 indicates that the object was allocated using reflection, with the other three components identifying the method performing the allocation (Constructor/Array.newInstance(…)). If an allocation site could not be determined by the Immutability Analysis, this is indicated by a question mark.

The remaining lines of a record report whether a field (first column) was mutated after its initialization (second column) and whether zeroing mattered (third column), i.e., whether the “zero” value (0, null, false, etc.) was either not written to or read before being explicitly overwritten during initialization. The field in question is described by a triple of class name, field name, and type descriptor, again with components separated by the “File Separator” control character ('\034').