求助下各位大佬,虽然inuse_space记录的是heap上的内存,但是我有个进程RES有100M,pprof查看到的inuse_space加起来才几M,是我理解错了这俩概念吗?
pprof是在服务内部开了端口监听,然后使用本地的go tool查看的:
go tool pprof -http=:xxxx http://x.x.x.x:xxxx/debug/pprof/heap
还有就是go程序栈内存有没有啥工具能看?
送你一段代码,RES是这么算的 RES=HeapInuse + HeapIdle - HeapReleased
```
package main
import (
"fmt"
"runtime"
"time"
)
func main() {
fmt.Printf("%v\t%v\t%v\t%v\n", "HeapInuse", "HeapIdle", "HeapReleased", "RES")
for i := 0; i < 200; i++ {
_ = make([]int, i*1000000)
m := runtime.MemStats{}
runtime.ReadMemStats(&m)
fmt.Printf("%v\t%v\t%v\t%v\n", m.HeapInuse, m.HeapIdle, m.HeapReleased, m.HeapInuse + m.HeapIdle - m.HeapReleased)
time.Sleep(time.Second)
}
}
```
#1