Problem
Tenant instances start with no GOMEMLIMIT (and no GOMAXPROCS). The cgroup caps them (memory.max from the size, memory.high at 90%, internal/cgroup/cgroup.go), but the Go runtime does not know about the cap. With the default GOGC=100 a heap is allowed to grow to twice its live size before a collection, so each process keeps headroom it never needs, and it meets memory.high throttling or an OOM kill before the collector works hard.
On a box with ~100 awake Go instances (a storefront app whose instances crawlers keep awake), that headroom is most of the per-process cost. Today GOMEMLIMIT is set only on platform units (Litestream, claim units, the gVisor run sandbox in internal/instancectl/ocibundle.go).
GOMAXPROCS: since Go 1.25 the runtime reads the cgroup CPU limit, but instances run with CPU weight, not cpu.max, so every instance sees every core of the box. Each P carries its own caches and the GC uses 25% of GOMAXPROCS as workers, so 100 processes each sized for 8+ cores cost more memory and cause GC CPU spikes across the box.
Proposal
When the activator starts a binary instance, set in its environment, unless the release or app config already sets them:
GOMEMLIMIT = about 80% of the size's memory.max (below memory.high at 90%, leaving room for stacks, cgo and SQLite page cache).GOMAXPROCS = a per-size value (e.g. small 1, medium 2, large+ 4), or the box's cores, whichever is lower.- Also
CARLOS_MEMORY_MIB, matching #892 S1 for rootfs processes, so apps that tune themselves have one number.
App overrides win (an app that sets its own values keeps them). Non-Go apps ignore the variables.
Why now
A developer evaluating CARLOS for a multi-tenant storefront raised per-process Go overhead as a reason to prefer one shared process. This change is small, invisible to apps that already tune themselves, and lowers resident memory for every awake Go instance on shared boxes.
Related: #892 (S1 CARLOS_MEMORY_MIB), #323, #946, #524 (memory-aware wake admission).