diff --git a/cmd/containerd-shim/main_unix.go b/cmd/containerd-shim/main_unix.go index e1996fd92..307d44899 100644 --- a/cmd/containerd-shim/main_unix.go +++ b/cmd/containerd-shim/main_unix.go @@ -12,9 +12,11 @@ import ( "os/exec" "os/signal" "runtime" + "runtime/debug" "strings" "sync" "syscall" + "time" "github.com/containerd/containerd/events" "github.com/containerd/containerd/linux/proc" @@ -58,6 +60,13 @@ func init() { } func main() { + debug.SetGCPercent(10) + go func() { + for range time.Tick(30 * time.Second) { + debug.FreeOSMemory() + } + }() + if debugFlag { logrus.SetLevel(logrus.DebugLevel) }