ReviewOS

home-lang/home

fix(codegen): real allocator with deallocation in native binaries

#797
Open chris opened this 8 days ago ·
8 days ago

Problem

Every heap allocation in native Home binaries is its own page-rounded mmap, and munmap never appears in native codegen. A long-running server's RSS grows without bound, at ≥4 KiB per small object. The HEAP_START/HEAP_SIZE constants still describe an old 1 MiB bump allocator and are unused.

Evidence (origin/main @ d4b219507)

Scope

  • Ship a size-class allocator in the native runtime (or link a proven one).
  • Emit frees at ownership drop points.
  • Delete the dead bump-allocator constants.

Acceptance criteria

  • Allocating and dropping 10M small objects in a loop stays under a fixed RSS ceiling.
  • Allocation throughput benchmarked against the current mmap-per-object path.

Part of #814.

8 days ago

Pushed c5e5e1b18 directly to main: refactor(codegen): remove obsolete bump allocator (#797).

This removes the unreachable fixed-address bump allocator implementation, its HEAP_START/HEAP_SIZE constants, and dead per-codegen heap/bump state. The active allocator remains the page-rounded anonymous-mapping path. A new generated-executable regression constructs a dynamic Array, writes through push, reads through pop, and exits with the stored value, so mapped storage is exercised at runtime rather than asserted from source text. The compiler pipeline now documents the page-per-object/no-free limitation explicitly.

Verification under the serialized guard:

  • focused mapped-array executable: 1/1 passed, 375 MB peak
  • full codegen gate: 17/17 passed, 443 MB peak
  • test-file format and diff checks passed

#797 remains open: this cleanup does not implement size classes, ownership-drop frees, the 10M-object RSS ceiling, or throughput benchmarks.

Sign in to comment on this issue.