Which version of Go?
On Thursday, 29 September 2016 00:18:29 UTC+10, 刘桂祥 wrote:
>
> // example1.go
> package main
>
>
> func main() {
>
> for i := 0; i < 2; i++ {
> m := make(map[int]int)
>
>
> m[1] = 100
> }
>
>
> }
>
>
> main make(map[int]int) does not escape
>
>
> // example2.go
> package main
>
>
> func main() {
> var m map[int]int
> for i := 0; i < 2; i++ {
> m = make(map[int]int)
>
>
> m[1] = 100
> }
>
>
> }
>
> make(map[int]int) escapes to heap why ???
>
>
>
--
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.