Files

23 lines
502 B
Go
Raw Permalink Normal View History

package shared
import (
2024-10-28 22:31:14 +01:00
"log/slog"
2025-07-29 09:49:24 +02:00
"os"
"runtime"
2024-10-28 22:31:14 +01:00
"github.com/KimMachineGun/automemlimit/memlimit"
)
2024-10-28 22:31:14 +01:00
// we init the memlimit here to include it for ocis als well as individual service binaries
func init() {
slog.SetLogLoggerLevel(slog.LevelError)
2025-07-29 09:49:24 +02:00
// Enable system memory provider on non-Linux systems to avoid cgroups errors
if runtime.GOOS != "linux" {
os.Setenv("AUTOMEMLIMIT_EXPERIMENT", "system")
}
2024-10-28 22:31:14 +01:00
_, _ = memlimit.SetGoMemLimitWithOpts(
memlimit.WithLogger(slog.Default()),
)
}