noalloc: Tooling and libraries to enforce zero heap allocations in Golang

g0xA52A2A 81 points 70 comments October 28, 2026
github.com · View on Hacker News

Discussion Highlights (6 comments)

zinodaur

I love it. Any thoughts on allowing (value type) Pointers into a Region?

andrewla

The end state of every garbage collected language is a suite of tools to prevent garbage collection at all costs. I think we can learn something here.

kvemkon

Go compiler has an advanced escaping analyzer. Wouldn't it be easier and better to add this noalloc-analyzer feature to golang directly?

eatonphil

Hey folks, this is my project. I really liked OxCaml's zero_alloc feature [0], something you don't get in Rust or Zig or Go*, and have been trying to get a handle on allocations in The Consensus's code search engine. It's an extremely early project but it's been helping me out a bunch already. Would love to hear your bug reports or requests if you try running it on your codebase. [0] https://theconsensus.dev/p/2026/06/27/the-feature-in-oxcaml-... * I think you can get this in Clang and maybe GCC with `__attribute__((nonallocating))` though.

gritzko

If you don't allocate, why do you even need Go or Rust? LLMs handle less elegant syntax just as well. I use a zero-malloc C dialect with slices and bounds-checking. Just recently I was sketching a smallish database in zero-malloc C. https://replicated.live/blog/db That was partly because most LSM data structures are read-only, so mmap was good enough and concurrent access was safe for the bulk of the data. The "hot zone" (memtable) then requires some intricate engineering, but that is the case either way. You can go quite far with zero-malloc C.

kristianp

Interesting difference between Go and Python, `c.counts[name] += n` can allocate if name isn't already present, whereas in Python you get a key error.

Semantic search powered by Rivestack pgvector
3,874 stories · 35,194 chunks indexed