package main
import (
"fmt"
)
func main() {
a := interface{}(100)
println(&a, a)
fmt.Sprint(a)
}
go run x.go the output:
0xc42003bf18 (0x89040,0xc42000a2c0)
I just want to ask 0xc42000a2c0 as the a (interface{}) 's data pointer is
point to where ? heap ?
also I test this:
func BenchmarkFmtEscap3(b *testing.B) {
b.ReportAllocs()
for i := 0; i < b.N; i++ {
a := interface{}(100)
fmt.Sprint(a)
}
}
BenchmarkFmtEscap3-4 10000000 141 ns/op 16 B/op 2
allocs/op
why is 2 allocs and 16bytes ??
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.