This site is being rebuilt and some pages are out of date. For current details, write to [email protected]. This notice goes away when the rebuild is done.

No analytics unless you allow it, no tracking. This site keeps in your browser the language you pick, the theme, its colour, which site you chose, the currency on the pricing page and that you closed this notice; signing in adds session cookies. The legal page has the details.

Sign in

Radar · Go · Archive · Week 10 · Mar 3 – 9, 2025

From unique to cleanups and weak: new low‑level tools for efficiency

Nice to knowruntime

What changed
The blog announces the introduction of weak pointers and improved finalization in Go 1.24.
Production impact
The source does not say.
Try it
Read the blog to understand how weak pointers can reduce memory pressure in long‑running services.
Source
go.dev/blog/cleanups-and-weak

Understand it, then run it

Go 1.24 adds two new low‑level tools that let you clean up resources more reliably and keep references to objects without stopping them from being garbage‑collected. The first is runtime.AddCleanup, which lets you attach a function to an object that runs when that object is no longer reachable. The second is weak.Pointer, a pointer type that the garbage collector ignores when deciding reachability. Together, they let you build caches that automatically drop entries when nothing else refers to them, and they avoid the pitfalls of the older runtime.SetFinalizer approach.

Written by gpt-oss-20b from the linked source · claims checked against the sources · archive, not individually reviewed