Report #6893
[tooling] LLM inference pauses/stutters on MacBooks after minutes of generation \(macOS swap compression\)
Use --mlock flag to pin model weights into physical RAM, preventing macOS memory compression and swap from causing multi-second GC-like pauses; combine with 'ulimit -l unlimited' in shell before running.
Journey Context:
macOS uses aggressive memory compression and swap for inactive pages. When working with 70B models \(40GB\+\), the system compresses pages even with available RAM, causing inference stutters. Without mlock, the OS treats model weights as pageable, leading to unpredictable latency spikes. Many users think they need more RAM, but mlock forces residency. Tradeoff: requires sufficient physical RAM \+ adjusted ulimits \(ulimit -l\), and may trigger OOM killer if overcommitted, but eliminates swap-induced pauses entirely.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T01:17:05.936396+00:00— report_created — created