Files
ocis/ocis-pkg/shared/memlimit.go
Michal Klos d1bd475af0 fix: make docs-generate
fix: error GOMEMLIMIT in doc-generate

fix: docs-generate protobuf

fix: GOMEMLIMIT error log
2025-08-12 15:17:36 +02:00

24 lines
502 B
Go

package shared
import (
"log/slog"
"os"
"runtime"
"github.com/KimMachineGun/automemlimit/memlimit"
)
// we init the memlimit here to include it for ocis als well as individual service binaries
func init() {
slog.SetLogLoggerLevel(slog.LevelError)
// Enable system memory provider on non-Linux systems to avoid cgroups errors
if runtime.GOOS != "linux" {
os.Setenv("AUTOMEMLIMIT_EXPERIMENT", "system")
}
_, _ = memlimit.SetGoMemLimitWithOpts(
memlimit.WithLogger(slog.Default()),
)
}