package main import "testing" type s struct { f *int } func heap() { x := &s{} x.f = new(int) } func BenchmarkAlloc(b *testing.B) { b.ReportAllocs() for i := 0; i <= b.N; i++ { heap() } }