noalloc: Tooling and libraries to enforce zero heap allocations in Golang
Repository · https://github.com/theconsensuslabs/noalloc
First seen by Oriel on .
AI summary
noalloc is an experimental Go toolkit that statically checks call trees for heap allocations and provides fixed-capacity data structures and generated JSON handling for allocation-free code.
- The noalloc CLI reports allocation sites across a function's call tree, supports root, exemption, fixed, and append directives, and exits with status 1 when allocations are found.
- The bounded package provides fixed-capacity Buf, Vec, Slice, and Map types, plus Pool and Region for borrowing memory with explicit budgets and reuse.
- Generated JSON encoders and decoders avoid allocations, including their first call, but require caller-provided memory and reject unsupported types such as maps and interfaces.
- In the reported benchmark, jsongen used zero allocations per feed decode but was slower than several alternatives, including goccy/go-json and encoding/json variants.
- The repository is AI-written, production-used at The Consensus, experimental, and requires Go 1.27 or later; memory exhaustion, region reuse, concurrency, and stale slices require careful handling.
#go #zero allocation #json #memory management
Generated by gpt-5.6-sol. Check the original for details.
Metric trends
Last 30 days · Up to 120 recorded samples per source and metric, with reposts kept separate · First and latest retained
Points
Score reported by the source.
- Hacker News: 81, latest observation ; +70 over observed period since
- Lobsters: 0, latest observation
Comments
Comment count reported by the source.
- Hacker News: 55, latest observation ; +54 over observed period since
- Lobsters: 0, latest observation
Aliases
| Source | External ID | URL |
|---|---|---|
| Hacker News | 50278645 | https://github.com/theconsensuslabs/noalloc Read discussion |
| Lobsters | ycqwny | https://github.com/theconsensuslabs/noalloc Read discussion |