example

command
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 8, 2026 License: MIT Imports: 4 Imported by: 0

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL