mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-09-10 02:25:56 +00:00
fed7179c92
Pulse under a systemd MemoryMax, docker --memory, or Kubernetes limit ran with a GC that was blind to the cap: GOGC=100 lets total heap float to roughly twice the live set, so a capped process grows until the kernel OOM-kills it instead of collecting harder near the boundary. The demo droplet's kill history (three OOM kills in July under an 800M cap) is this mechanism, and any containerized install with a memory limit is exposed the same way. At startup, when GOMEMLIMIT is not set by the operator, resolve the process cgroup (v2 ancestor walk taking the smallest memory.max on the path, v1 limit_in_bytes fallback) and set the runtime soft limit to 90% of it, leaving headroom for stacks, mmap, and CGO. Best effort: no detectable limit leaves GC defaults untouched. Contract-Neutral: runtime GC limit alignment: no payload or contract delta