noalloc is a Go command-line checker and library suite for preventing heap allocations in selected functions as code evolves. Developers mark entry points with `//noalloc:root`; the checker follows their call trees, identifies allocation sites and unresolved calls, and exits with a failure when it finds allocations or cannot complete its analysis. Directives allow specific lines or types to be exempted, describe append-like functions, and mark methods that reuse fixed storage. It analyzes compiler escape information and call relationships, including interface calls, and can inspect dependencies from source. The project requires Go 1.27 or later and warns that compiler output can change, so toolchains should be pinned and checks rerun after upgrades.
The companion `bounded` package provides fixed-capacity buffers, vectors, slices, and maps, with writes that exceed available space recorded as a full condition rather than silently growing memory. Storage can be supplied directly or borrowed in chunks from pools and regions; buffers can also flush to a writer. The README explains important trust boundaries: allowlists, exemptions, and fixed-storage annotations are accepted without independent verification, while some calls cannot be resolved and must be made concrete or exempted. Tests can measure selected functions for zero allocations. The project is explicitly experimental and AI-written, though human-guided and used in production at The Consensus; its tools aim to make allocation-free code practical to maintain, not merely possible to write once.
Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.