PyTorch DevLog: Why You Should Never Free Pinned Memory

ezyang · x · 2026-08-10

PyTorch core contributor Edward Yang shared a deep technical dive into the mechanics of CUDA pinned memory, a post drafted by Claude and edited by the author.

The article argues that despite traditional memory management practices, you should never actually free pinned memory in steady-state high-performance workflows. The key reasons include:

The author notes that major LLM frameworks like Megatron-LM and vLLM already implement this by allocating dedicated pinned pools upfront and holding them until the process exits, with some even offering config flags specifically to prevent pinned buffers from being freed.

Original post →

More from Infra

Infra channel →