Skip to content

Fix false OOM on Linux/WSL2: use MemAvailable instead of Freeram#5

Open
GavinPalmer1984 wants to merge 1 commit intocomputerex:mainfrom
GavinPalmer1984:fix/issue-3-linux-memory-detection
Open

Fix false OOM on Linux/WSL2: use MemAvailable instead of Freeram#5
GavinPalmer1984 wants to merge 1 commit intocomputerex:mainfrom
GavinPalmer1984:fix/issue-3-linux-memory-detection

Conversation

@GavinPalmer1984
Copy link

Summary

  • mmap/sysinfo_unix.go used syscall.Sysinfo_t.Freeram (maps to MemFree), which excludes reclaimable page cache and is near zero on Linux/WSL2
  • Now reads MemAvailable from /proc/meminfo, falling back to Freeram if unavailable
  • Tested on WSL2 (18GB total, 9.3GB available but only 290MB MemFree) — model loads successfully after fix

Test plan

  • Verified on WSL2 with 18GB RAM where MemFree was 290MB but MemAvailable was 9.3GB
  • Model loads and runs successfully after the fix
  • Verify no regression on native Linux
  • Verify fallback works on systems without /proc/meminfo (e.g. some containers)

Fixes #3

🤖 Generated with Claude Code

Freeram (from syscall.Sysinfo_t) maps to MemFree in /proc/meminfo,
which excludes reclaimable page cache. On Linux/WSL2 this is almost
always near zero, causing dlgo to refuse to load models despite
having plenty of available memory.

Read MemAvailable from /proc/meminfo instead, falling back to
Freeram if /proc/meminfo is unavailable.

Fixes computerex#3

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Linux/WSL2: false OOM due to using Freeram instead of MemAvailable

1 participant