debug.FreeOSMemory

This commit is contained in:
Josh Baker 2016-12-22 14:52:37 -07:00
parent 19da27b562
commit 5d378b8ec9
2 changed files with 6 additions and 1 deletions

View File

@ -10,6 +10,7 @@ import (
"os"
"path"
"runtime"
"runtime/debug"
"strings"
"sync"
"time"
@ -552,7 +553,8 @@ func (c *Controller) command(msg *server.Message, w io.Writer) (res string, d co
case "aofmd5":
res, err = c.cmdAOFMD5(msg)
case "gc":
go runtime.GC()
runtime.GC()
debug.FreeOSMemory()
res = server.OKMessage(msg, time.Now())
case "aofshrink":
go c.aofshrink()

View File

@ -4,6 +4,7 @@ import (
"bytes"
"encoding/json"
"fmt"
"os"
"runtime"
"sort"
"strings"
@ -80,6 +81,7 @@ func (c *Controller) cmdServer(msg *server.Message) (res string, err error) {
m["following"] = fmt.Sprintf("%s:%d", c.config.FollowHost, c.config.FollowPort)
m["caught_up"] = c.fcup
}
m["pid"] = os.Getpid()
m["aof_size"] = c.aofsz
m["num_collections"] = c.cols.Len()
m["num_hooks"] = len(c.hooks)
@ -111,6 +113,7 @@ func (c *Controller) cmdServer(msg *server.Message) (res string, err error) {
}
m["mem_alloc"] = mem.Alloc
m["heap_size"] = mem.HeapAlloc
m["heap_released"] = mem.HeapReleased
m["max_heap_size"] = c.config.MaxMemory
m["avg_item_size"] = avgsz
m["pointer_size"] = (32 << uintptr(uint64(^uintptr(0))>>63)) / 8