go 1.7

在 2016年9月28日星期三 UTC+8下午10:41:09,Dave Cheney写道:
>
> 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 golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to