AI article
MPS backend out of memory on a Mac: what the numbers mean and how to set the watermark
Community description: On a 48 GB Mac the default MPS limit is higher than the RAM, so a big PyTorch job swaps before it ever raises this error. Measured: what the default, 0.0, 1.0, 0.8 and 0.5 do, and why the low ratio has to be set too.
Dev.to | Oct 14, 2026 | Rodion Kazennov
Automated excerpt
RuntimeError: MPS backend out of memory (MPS allocated: 18. 50 GiB, other allocations: 448. 00 KiB, max allowed: 18. 72 GiB). Use PYTORCH_MPS_HIGH_WATERMARK_RATIO=0. 0 to disable upper limit for memory allocations (may cause system failure). On my Mac that is 37. 44 GiB, and 0. 5 × 37. 44 = 18. 72 GiB, the number in the error above.
Selected automatically from source text; not independently written or fact-checked. Read the original for full context.