Merge pull request #2055 from stevvooe/aggressive-memory-shim

cmd/containerd-shim: aggressive memory reclamation
This commit is contained in:
Stephen Day 2018-01-24 16:06:57 -08:00 committed by GitHub
commit 3fcc52b091
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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