std.Io.Writer.Allocating ate all my memory
Summary
A blog post reveals a memory over-allocation bug in Zig's std.Io.Writer.Allocating due to the `drain` function incorrectly reserving space for the splat parameter on every data slice, causing unexpected memory growth.
View Cached Full Text
Cached at: 07/30/26, 07:54 PM
Similar Articles
zalloc: Use zig allocators in your c code
zalloc replaces malloc, calloc, realloc, and free in C modules with Zig allocators, enabling Zig-style memory management in C code.
Your Rust Service Isn't Leaking — It Could Be the Allocator
This article describes a debugging journey where a Rust service's memory remained high under load despite no leaks, due to glibc's ptmalloc allocator not releasing freed memory back to the OS. It explains the allocator behavior and provides insights for Rust developers.
Finding and Fixing Ghostty's Largest Memory Leak
A detailed technical post on diagnosing and fixing a major memory leak in the Ghostty terminal emulator, caused by a logic bug in scrollback pruning with non-standard page sizes. The fix has been merged and will be in the upcoming 1.3 release.
Steering Zig Fmt
A blog post describing two tips for using `zig fmt` effectively, highlighting its 'steerable' formatting approach where trailing commas and line breaks control layout decisions, and showcasing columnar array formatting.
The hidden cost of mpsc channels
This article analyzes unexpected memory allocation costs in Tokio's mpsc channels in Rust, revealing a fixed overhead per channel due to internal block sizing. It demonstrates how this impacts large-scale applications like Agent Gateway and suggests alternatives like futures-channel for memory efficiency.