Documentation
¶
Overview ¶
Command example demonstrates and verifies the end-to-end effect of memlimit: it applies GOMEMLIMIT from the cgroup, then reads the runtime's current value back via debug.SetMemoryLimit(-1) to confirm it was actually applied.
# no limit -> no-op, GOMEMLIMIT stays at the default (max int64) go run . # real 256 MiB limit -> GOMEMLIMIT set to 90% (241591910) docker run --rm --memory=256m -v <project>:/work \ -w /work/gocronx/memlimit golang:1.23 go run ./example
Click to show internal directories.
Click to hide internal directories.