15 Star 52 Fork 12

DiDi-opensource / sgt

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
memory.go 354 Bytes
一键复制 编辑 原始数据 按行查看 历史
Ulric Qin 提交于 2018-10-12 13:22 . push to github
package timer
import (
"log"
"runtime"
"sgt/sgd/config"
)
const (
max_mem uint64 = 30 * 1024 * 1024
)
func checkMem() {
m := &runtime.MemStats{}
runtime.ReadMemStats(m)
if config.Dev {
log.Printf("INF: mem use: %dMB", m.HeapSys/1024/1024)
}
if m.HeapSys > max_mem {
log.Fatalf("FAT: mem use: %dMB, overload", m.HeapSys/1024/1024)
}
}
Go
1
https://gitee.com/didiopensource/sgt.git
git@gitee.com:didiopensource/sgt.git
didiopensource
sgt
sgt
3c772d0974fe

搜索帮助