mirror of https://github.com/tidwall/tile38.git
Merge branch 'leak' into memoptz
This commit is contained in:
commit
b8a0f59b81
|
@ -10,6 +10,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
"runtime/debug"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
@ -552,7 +553,8 @@ func (c *Controller) command(msg *server.Message, w io.Writer) (res string, d co
|
||||||
case "aofmd5":
|
case "aofmd5":
|
||||||
res, err = c.cmdAOFMD5(msg)
|
res, err = c.cmdAOFMD5(msg)
|
||||||
case "gc":
|
case "gc":
|
||||||
go runtime.GC()
|
runtime.GC()
|
||||||
|
debug.FreeOSMemory()
|
||||||
res = server.OKMessage(msg, time.Now())
|
res = server.OKMessage(msg, time.Now())
|
||||||
case "aofshrink":
|
case "aofshrink":
|
||||||
go c.aofshrink()
|
go c.aofshrink()
|
||||||
|
|
|
@ -4,6 +4,7 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"os"
|
||||||
"runtime"
|
"runtime"
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"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["following"] = fmt.Sprintf("%s:%d", c.config.FollowHost, c.config.FollowPort)
|
||||||
m["caught_up"] = c.fcup
|
m["caught_up"] = c.fcup
|
||||||
}
|
}
|
||||||
|
m["pid"] = os.Getpid()
|
||||||
m["aof_size"] = c.aofsz
|
m["aof_size"] = c.aofsz
|
||||||
m["num_collections"] = c.cols.Len()
|
m["num_collections"] = c.cols.Len()
|
||||||
m["num_hooks"] = len(c.hooks)
|
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["mem_alloc"] = mem.Alloc
|
||||||
m["heap_size"] = mem.HeapAlloc
|
m["heap_size"] = mem.HeapAlloc
|
||||||
|
m["heap_released"] = mem.HeapReleased
|
||||||
m["max_heap_size"] = c.config.MaxMemory
|
m["max_heap_size"] = c.config.MaxMemory
|
||||||
m["avg_item_size"] = avgsz
|
m["avg_item_size"] = avgsz
|
||||||
m["pointer_size"] = (32 << uintptr(uint64(^uintptr(0))>>63)) / 8
|
m["pointer_size"] = (32 << uintptr(uint64(^uintptr(0))>>63)) / 8
|
||||||
|
|
Loading…
Reference in New Issue