In the following code, "make([]T, n)" is reported as escaped.
But does it really always escape at run time?
Does the report just mean "make([]T, n) possibly escapes to heap"?
package main
type T int
const K = 1<<13
const N = 1<<12
var n = N
var i = n-1
func main() {
var r = make([]T, N) // make([]T, N) does not escape
println(r[i])
var r2 = make([]T, n) // make([]T, n) escapes to heap
println(r2[i])
var r3 = make([]T, K) // make([]T, K) escapes to heap
println(r3[i])
}
--
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].
To view this discussion on the web visit
https://groups.google.com/d/msgid/golang-nuts/0ef15402-2e71-4522-bf67-26f766da55e5n%40googlegroups.com.