1 day ago · Tech · hide · 0 comments

In my last post, The hidden cost of mpsc channels, I discussed a common pitfall with Rust mpsc channels using more memory than intuitive (and subsequently got roasted by people pretending they read the footnotes of the documentation of every transitive dependency they use 🙂). I recently stumbled upon a similar surprising cause of memory utilization in Go, this time in sync.Pool. sync.Pool's "purpose is to cache allocated but unused items for later reuse, relieving pressure on the garbage collector." Notice the goal is not to reduce memory usage, but to reduce allocations. However, without being familiar with the implementation details, it's easy to assume that it doesn't increase memory usage much.

No comments yet. Log in to reply on the Fediverse. Comments will appear here.