logoalt Hacker News

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

67 points • by g0xA52A2A • yesterday at 6:29 PM • 42 comments • view on HN

Comments

andrewla • today at 5:41 PM

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.

➕ show 3 replies
eatonphil • today at 6:54 PM

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.

➕ show 1 reply
gritzko • today at 7:00 PM

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.

➕ show 1 reply
kvemkon • today at 6:07 PM

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

zinodaur • today at 4:47 PM

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