# Chapter 33: Automatic Memory Management English | [日本語](README.ja.md) [Previous: Chapter 32 — Compiler Internal Speedups](../chapter32/README.md) Allocation2 is the only memory-analysis phase. It runs after Opto, field-layout finalization, and LoopTree, before TypeCheck. It computes allocation-site points-to sets, reference-field relationships, escapes, and incoming field counts. Separate-compilation constraints are incomplete. The pass does not yet prove ownership, choose frame lifetimes, lower a storage policy, or implement recycling. The [memory-management design](docs/memory-management.md) explains the abstraction, its precision limits, ownership and lifetime proofs, storage choices, deletion semantics, and academic references. The [growing-array design](docs/growing-arrays.md) specifies future construction scopes and illustrates their storage requirements. ## Current implementation Each NewNode or static object has a Site. Pointer values and reference fields have Points containing sets of Sites and an outside-storage flag. Fields use weak updates; array indices share one field. Registered dependencies requeue consumers when facts grow. Nullability stays in the type analysis. Object metadata retains signatures, optimized return states, function names/sizes, and class-initialization dependencies. It has no independent function-effect or allocation-contract pass. Bodies remain unloaded until needed. Serialized IR format is 10 (`C0DA`); older objects must be rebuilt. The earlier allocation planner and deletion checker are removed, including their flags and adapters. Their source remains available in Git history. Array deletion syntax remains, but ownership proofs and runtime recycling are unfinished; deletion must not be treated as an implemented no-op. ## Building and inspecting Run from `chapter33`: ```sh make -j8 release make -j8 test CLASS=Chapter33Test make -j8 test CLASS=Chapter33Test METHOD=testAllocation2SharedFactory "TEST_JAVA_OPTS=-XX:ActiveProcessorCount=2 -Dsimple.alloc2.dump=true" make -j8 tests_nographics ``` `verify()` checks fixed-point stability when requested by tests or assertions. It does not establish complete boundary handling or ownership. The current tests include unresolved separate-compilation, escape, and construction cases. See also the [grammar](docs/33-grammar.md), [examples](docs/examples/README.md), and [roadmap](../docs/roadmap.md).