We could discuss what has "gone wrong" in the Go compiler; and how to make 
it work at least in theory.

Unfortunately, me not being paid by Google is a line I am both unable and 
unwilling to cross.

I feel sorry for not being able to discuss the subject of escape analysis 
which by itself is quite fascinating.

Sincerely
atomsymbol

On Wednesday, September 28, 2016 at 4:18:29 PM UTC+2, 刘桂祥 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 golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to