~/talk

The Strengths of the `weak` Package: Weak Pointers Arrive in Go

Talkat GopherCon UK 2025 · 2025-08-13..08-15· [go]
name:Sam Burns
links:none on file
slides:none on file

Go adds a small generics-based weak package that exposes weak.make and weak.Value to create non-owning pointers that return nil after GC, so you must nil-check every resolve; examples implement an in-memory cache that lets the collector reclaim entries and an observer pattern where subscribers don’t prolong subjects. The runtime tool used in demos is runtime.GC to force collection. Weak pointers are thread-safe, interact with escape analysis and heap allocation, and the new experimental GreenTea GC reports 10–40% marking CPU reduction on Intel workloads.

AI-written summary · about

  1. 0:00Introduction
  2. 2:11Overview of weak pointers
  3. 7:35Working with weak pointers
  4. 13:43Garbage collection in Go
  5. 23:45GC characteristics and tuning
  6. 28:49Experimental GC and features
  7. 36:54Language comparison
  8. 38:08Caching use case
  9. 43:07Observer pattern use case
  10. 49:29Best practices and conclusion
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.