diff --git a/controller/controller.go b/controller/controller.go index 3029102d..9023f9d1 100644 --- a/controller/controller.go +++ b/controller/controller.go @@ -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() diff --git a/controller/stats.go b/controller/stats.go index 1ca933f4..ab2cab15 100644 --- a/controller/stats.go +++ b/controller/stats.go @@ -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