On Thu, Jan 26, 2017 at 7:53 PM, T L <tapir....@gmail.com> wrote:
>
> On Friday, January 27, 2017 at 4:05:03 AM UTC+8, Ian Lance Taylor wrote:
>>
>> On Thu, Jan 26, 2017 at 11:10 AM, T L <tapi...@gmail.com> wrote:
>> >
>> > I still don't understand what are implicit memory allocations, could you
>> > make an explanation?
>>
>> An example of an implicit memory allocation:
>>
>> var globalVar *int
>> func f() {
>>     var i int
>>     globalVar = &i
>> }
>>
>> Another one:
>>
>> var globalVar interface{}
>> func f() {
>>     globalVar = 0
>> }
>>
>> Ian
>
>
> It looks -+ doesn't think the second one is implicit memory allocation.
> "-m" really think it is an "escapes to heap".

My apologies for getting it wrong.

> So I am still not very clear on what is implicit memory allocation.
> It looks the output of -+ is hard to predict.

Yes, -+ is hard to predict.  That is why it is not documented and is
only intended for use when compiling the runtime package.

Ian

-- 
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