Hacker News
Zig: Pointer Stability for ArrayLists
The Zig standard library now supports pointer-stability for `std.ArrayList` via `lockPointers()` and `unlockPointers()`, extending the technique previously added to hash maps. The article demonstrates a bug where lines stored in one `ArrayList` become invalid after the backing history list reallocates, and shows that enabling pointer locks triggers a panic that pinpoints the unsafe assumption. This mechanism ensures that pointers to array elements remain valid across capacity changes, improving memory-safety debugging.