Merge pull request #2055 from stevvooe/aggressive-memory-shim
cmd/containerd-shim: aggressive memory reclamation
This commit is contained in:
commit
3fcc52b091
@ -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)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user