frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Golang's big miss on memory arenas

https://avittig.medium.com/golangs-big-miss-on-memory-arenas-f1375524cc90
37•andr3wV•6d ago

Comments

RohMin•1h ago
I wish Odin could gain more traction
guywithahat•51m ago
I didn't realize odin had a similar threading model to go with built-in channels, that's pretty neat. Odin might be my next toy language
christophilus•7m ago
It’s a great little language. I just wish it had a bigger standard library.
didibus•1h ago
Interesting that it never talks about direct competitors to the "middle ground" as well, like Java, C#, Erlang, Haskell, various Lisps, etc.
pjmlp•43m ago
Typical Go culture.
convolvatron•59m ago
one question that always plagues me when we talk about mixing manual and automatic memory systems is...how does it work? if we have a mixed graph of automatic and manual objects, it seems like we dont have a choice except to have garbage collection enabled for everything and make a new root (call it the programmer) that keeps track of whether or not the object has been explicitly freed.

since we still have the tracing overhead and the same lifetimes, we haven't really gained that much by having manual memory.

D's best take at this is a compile-time assert that basically forbids us from allocating GC memory in the affected region (please correct me if I'm wrong), but that is pretty limited.

does anyone else have a good narrative for how this would work?

alexisread•49m ago
There are many automatic memory management systems ranging from the simple clearup of immutable systems (https://justine.lol/sectorlisp2/), to region allocation, to refcounting with cycle collection, and the full-fat tracing.

I'd have thought that allocating a block of memory per-GC type would work. As-per Rust you can use mainly one type of GC with a smaller section for eg. cyclic data allocated in a region, which can be torn down when no longer in use.

If you think about it like a kernel, you can have manual management in the core (eg. hard-realtime stuff), and GC in userland. The core can even time-slice the GC. Forth is particularly amenable as it uses stacks, so you can run with just that for most of the time.

legobmw99•38m ago
There are some interesting experiments going on in the OCaml world that involve what they call 'modes', essentially a second type system for how a value is used separate from what it is. One goal of modes is to solve this problem. It ends up looking a bit like opting-in to a Rust-style borrow-checker for the relevant functions

https://oxcaml.org/documentation/modes/intro/

catigula•55m ago
>If you choose TypeScript or Python, you’ll hit a performance wall the moment you venture outside of web apps, CRUD servers, and modeling.

This really isn't very accurate. It is for Python, but JavaScript is massively performant. It's so performant that you can write game loops in it provided you work around the garbage collector, which, as noted, is a foible golang shares.

The solution is the same, to pre-allocate memory.

pjmlp•42m ago
Even Python is kind of debatable, if PyPy had a bit more of mainstream love.
bluecalm•46m ago
Arenas is one of those patterns that very easy to underestimate. I didn't know about it when I started programming and I run into huge performance issue where I needed to deallocate a huge (sometimes tens of GBs consisting of millions of objects) structure just to make a new one. It was often faster to kill the process and start a new one but that had other downsides. At some point we added a simple hand written arena-like allocator and used it along with malloc. The arena was there for objects on that big structure that will all die at the same point and malloc was for all the other things.

The speed-up was impossible to measure because deallocation that used to take up to 30 seconds (especially after repeat cycles of allocating/deallocating) was now instant.

Even though we had very little experience it was trivial to do in C. Imo it's critical for performance oriented language to make using multiple allocators convenient. GC is a known performance killer but so is malloc in some circumstances.

pjmlp•44m ago
They could probably learn one or two things on how Java and .NET do arenas, just saying.
riku_iki•5m ago
Not sure about .NET, but Java doesn't have arenas..
ideal_gas•35m ago
> By killing Memory Arenas, Go effectively capped its performance ceiling.

I'm still optimistic about potential improvements. (Granted, I doubt there will be anything landing in the near future beyond what the author has already mentioned.)

For example, there is an ongoing discussion on "memory regions" as a successor to the arena concept, without the API "infection" problem:

https://github.com/golang/go/discussions/70257

stlava•23m ago
At the end of the day there has to be a tradeoff between ease of use and performance. Having spent a lot of time optimizing high throughput services in go, it always felt like I was fighting the language. And that's because I was... sure they could add arenas but that just feels like what it is, a patch over the fact you're working alongside a GC.
willtemperley•17m ago
Isn’t a memory arena an application level issue? Like with Arrow I can memory map a file and expose a known range to an array as a buffer.
IncreasePosts•12m ago
Sure, but I think the problem is there is an existing paradigm of libraries allocating their own memory. So you would need to pass allocators around all over the place to make it work. If there was a paradigm of libraries not doing allocations and requiring the caller to allocate this wouldn't be such an issue.
tptacek•15m ago
The vibe I get from this post is of someone who hasn't routinely used arenas in the past and thinks they're kind of a big deal. But a huge part of the point of an arena is how simple it is. You can just build one. Meanwhile, the idea that arena handles were going to be threaded through every high-allocation path in the standard library is fanciful.
tpolzer•12m ago
I wonder whether it would be possible to retrofit Arena allocation transparently (and safely!) onto a language with a moving GC (which IIUC Go currently is not):

You could ask the programmer to mark some callstack as arena allocated and redirect all allocations to there while active and move everything that is still live once you leave the arena marked callstack (should be cheap if the live set is small, expensive but still safe otherwise).

riku_iki•7m ago
I am not sure I understand moving GC concern. Arena content would not be controlled by GC, otherwise it defeats the purpose of Arena.
9rx•7m ago
That sounds like the memory regions proposal[1], which is what came out of what was learned from tinkering with arenas.

[1] https://github.com/golang/go/discussions/70257

pkulak•4m ago
My guess is that when you measure, an arena is not worth the trouble when you run a generational GC, which essentially uses an arena for the eden space already. And if you have an arena, it's probably very short lived and would otherwise live entirely in eden.

Size of Life

https://neal.fun/size-of-life/
387•eatonphil•2h ago•76 comments

DeepSeek uses banned Nvidia chips for AI model, report says

https://finance.yahoo.com/news/china-deepseek-uses-banned-nvidia-131207746.html
121•goodway•1h ago•84 comments

Is it a bubble?

https://www.oaktreecapital.com/insights/memo/is-it-a-bubble
23•saigrandhi•48m ago•1 comments

Australia begins enforcing world-first teen social media ban

https://www.reuters.com/legal/litigation/australia-social-media-ban-takes-effect-world-first-2025...
73•chirau•1d ago•158 comments

Qwen3-Omni-Flash-2025-12-01:a next-generation native multimodal large model

https://qwen.ai/blog?id=qwen3-omni-flash-20251201
74•pretext•2h ago•33 comments

Auto-grading decade-old Hacker News discussions with hindsight

https://karpathy.bearblog.dev/auto-grade-hn/
16•__rito__•55m ago•5 comments

Why the Sanitizer API is just `setHTML()`

https://frederikbraun.de/why-sethtml.html
40•birdculture•1d ago•17 comments

Factor 0.101 now available

https://re.factorcode.org/2025/12/factor-0-101-now-available.html
37•birdculture•6h ago•3 comments

9 Mothers (YC X26) Is Hiring

https://app.dover.com/jobs/9mothers
1•ukd1•1h ago

Launch HN: InspectMind (YC W24) – AI agent for reviewing construction drawings

18•aakashprasad91•2h ago•8 comments

COM Like a Bomb: Rust Outlook Add-in

https://tritium.legal/blog/outlook
39•piker•3h ago•14 comments

Qualcomm acquires RISC-V focused Ventana Micro Systems

https://www.qualcomm.com/news/releases/2025/12/qualcomm-acquires-ventana-micro-systems--deepening...
31•fork-bomber•2h ago•33 comments

Golang's big miss on memory arenas

https://avittig.medium.com/golangs-big-miss-on-memory-arenas-f1375524cc90
38•andr3wV•6d ago•23 comments

Valve: HDMI Forum Continues to Block HDMI 2.1 for Linux

https://www.heise.de/en/news/Valve-HDMI-Forum-Continues-to-Block-HDMI-2-1-for-Linux-11107440.html
62•OsrsNeedsf2P•59m ago•18 comments

Gundam is just the same as Jane Austen but happens to include giant mech suits

https://eli.li/gundam-is-just-the-same-as-jane-austen-but-happens-to-include-giant-mech-suits
7•surprisetalk•1w ago•0 comments

Volcanic eruptions set off a chain of events that brought Black Death to Europe

https://www.cam.ac.uk/stories/volcanoes-black-death
43•gmays•4d ago•4 comments

Typewriter Plotters (2022)

https://biosrhythm.com/?p=2143
25•LaSombra•5d ago•0 comments

Super-Flat ASTs

https://jhwlr.io/super-flat-ast/
25•mmphosis•6d ago•1 comments

RoboCrop: Teaching robots how to pick tomatoes

https://phys.org/news/2025-12-robocrop-robots-tomatoes.html
17•smurda•2h ago•7 comments

Revisiting "Let's Build a Compiler"

https://eli.thegreenplace.net/2025/revisiting-lets-build-a-compiler/
208•cui•11h ago•35 comments

Deprecations via warnings don't work for Python libraries

https://sethmlarson.dev/deprecations-via-warnings-dont-work-for-python-libraries
18•scolby33•2d ago•20 comments

England Historic Aerial Photo Explorer

https://historicengland.org.uk/images-books/archive/collections/aerial-photos/
17•davemateer•2h ago•3 comments

Map of all the buildings in the world

https://gizmodo.com/literally-a-map-showing-all-the-buildings-in-the-world-2000694696
137•dr_dshiv•5d ago•47 comments

PeerTube is recognized as a digital public good by Digital Public Goods Alliance

https://www.digitalpublicgoods.net/r/peertube
649•fsflover•1d ago•140 comments

Israel used Palantir technologies in pager attack in Lebanon

https://the307.substack.com/p/revealed-israel-used-palantir-technologies
111•cramsession•3h ago•49 comments

Rust in the kernel is no longer experimental

https://lwn.net/Articles/1049831/
863•rascul•15h ago•635 comments

In New York City, congestion pricing leads to marked drop in pollution

https://e360.yale.edu/digest/new-york-congestion-pricing-pollution
336•Brajeshwar•2h ago•328 comments

Cloth Simulation

https://cloth.mikail-khan.com/
155•adamch•1w ago•31 comments

New benchmark shows top LLMs struggle in real mental health care

https://swordhealth.com/newsroom/sword-introduces-mindeval
84•RicardoRei•4h ago•115 comments

Show HN: Gemini Pro 3 imagines the HN front page 10 years from now

https://dosaygo-studio.github.io/hn-front-page-2035/news
3217•keepamovin•1d ago•916 comments