Tagged articles
2 articles
Page 1 of 1
Xiao Lou's Tech Notes
Xiao Lou's Tech Notes
Mar 13, 2025 · Fundamentals

Master Go’s New Cleanup Functions and Weak Pointers for Safer Memory Management

Go 1.24 introduces runtime.AddCleanup and weak.Pointer, advanced garbage‑collector tools that let developers attach cleanup callbacks without retaining objects and safely cache objects via weak references, offering more precise memory management, eliminating finalizer pitfalls, and enabling custom unique‑package implementations.

cleanup functionsruntime.AddCleanupweak references
0 likes · 9 min read
Master Go’s New Cleanup Functions and Weak Pointers for Safer Memory Management
Sohu Tech Products
Sohu Tech Products
Jun 30, 2022 · Mobile Development

Understanding the Implementation of weak Pointers in the Objective‑C Runtime

This article explains how Objective‑C implements weak pointers using a hash‑based weak table, SideTables, ExplicitInit, and various low‑level C++ template functions such as storeWeak, weak_register_no_lock, and weak_clear_no_lock to ensure automatic nil‑assignment and safe deallocation.

C++ templatesMemory ManagementObjective‑C
0 likes · 19 min read
Understanding the Implementation of weak Pointers in the Objective‑C Runtime