[go-nuts] go analysis memory mallocs

2016-09-28 Thread Dave Cheney
Be careful that the compiler isnt removing some or all of your program. Check the asm to assert that your program is not being optimised away. Then check -gcflags=-m to see if the compiler is choosing a different escape analysis depending on the size of your allocation. -- You received this m

[go-nuts] go analysis memory mallocs

2016-09-28 Thread 刘桂祥
// example1.go package main import "runtime" func main() { m := new(runtime.MemStats) runtime.ReadMemStats(m) println(m.Alloc, m.Mallocs) cap := 1024 * 1024 * 3 s := make([]byte, cap) _ = s runtime.ReadMemStats(m) println(m.Alloc, m.Mallocs) } go run example1.go