On Sun, May 23, 2021 at 10:51 AM tapi...@gmail.com <tapir....@gmail.com> wrote:
> In the following code, "make([]T, n)" is reported as escaped. > But does it really always escape at run time? > Does the report just mean "make([]T, n) possibly escapes to heap"? > > The safe bet in the system is to mark every possible (pointer) value as escaping, and allocate everything on the heap. The escape analysis can thus be conservative. We can either prove that some data won't escape, or we give up. If we give up, we just allocate on the heap. If we have proof, we trigger an optimization and allocate it on the stack. So when something possibly escapes, it alludes to the fact that we don't have a proof, but nor do we have a counterexample handy. We simply don't know. An analysis which uses more time, or takes a different approach, might be able to determine escaping with finer grain. -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAGrdgiXTyx55BVVsWNxf%2BMHu8%2B7uxRHa%3DjxWHyonNBOYhofv0A%40mail.gmail.com.