On Friday, January 27, 2017 at 2:05:02 AM UTC+8, Ian Lance Taylor wrote: > > On Thu, Jan 26, 2017 at 9:18 AM, T L <tapi...@gmail.com <javascript:>> > wrote: > > > > On Wednesday, January 25, 2017 at 5:16:07 AM UTC+8, Ian Lance Taylor > wrote: > > > >> By not allocating memory. It is helped by a "secret" compiler option, > >> -+. When that compiler option is used, the compiler gives an error > >> for any implicit memory allocation. Note that this is not a change to > >> the language, it is, as you say, a subset of the language: operations > >> that implicitly allocate memory are forbidden. > >> > > > > What is the difference between -+ and -m for checking whether or not a > > variable "escapes to heap"? > > It looks the -m reports much more escapes than -+. > > -m is a debugging option for analyzing the compiler's escape analysis > pass. -+ is a code generation option that causes the compiler to > reject implicit memory allocations. They don't have anything in > common except that they are both related to memory allocation. For > example, if an apparent memory allocation (such as a call to new) > does not escape (as could be reported by -m) then it is accepted by -+ > (because it does not allocate memory). > > Ian >
It looks a call to new will not be reported by -m either. I still don't understand what are implicit memory allocations, could you make an explanation? -- 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.