v0.4.9
Dynamic Memory Limit
Replaces the static 2GB GOMEMLIMIT from v0.4.8 with platform-aware auto-detection.
What changed
- Auto-detect system memory on all platforms:
- Linux:
syscall.Sysinfo - macOS:
sysctl hw.memsize - Windows:
GlobalMemoryStatusEx
- Linux:
- GOMEMLIMIT set to 25% of physical RAM, clamped to [2GB, 8GB]
- Falls back to 4GB if detection fails
- User-configured
mem_limitstill takes priority
Why
The static 2GB default in v0.4.8 could cause excessive GC pressure on machines with plenty of RAM (e.g., a 64GB workstation was limited to 2GB). The new approach adapts to the system: a 16GB laptop gets a 4GB limit, a 32GB+ machine gets 8GB.
GOMEMLIMIT is a soft limit — hitting it causes more frequent garbage collection (slightly slower indexing) but never crashes or refuses allocations.
Examples
| System RAM | GOMEMLIMIT |
|---|---|
| 8 GB | 2 GB (min clamp) |
| 16 GB | 4 GB |
| 32 GB | 8 GB (max clamp) |
| 64 GB | 8 GB (max clamp) |
Upgrade
codebase-memory-mcp update