On Sun, Aug 4, 2019 at 8:14 PM B Carr <buc...@gmail.com> wrote: > > > Would that be where structs live as well?
Any global variable, struct or not, would be in the data section. For interfaces/pointers, the variable itself will be in the data section, but where it points may be in the heap. Any variable you declare within a function that escapes will be in heap. These are things such as having a global cache, and cache elements allocated within a function. Something similar to this is what I understood when I read your description in your first post. Any variable you declare within a function that is shared between goroutines escapes, and that will be in the heap. There are other ways a variable can escape. If a variable is declared in a function and it doesn't escape, then it will be on stack. > > On Sunday, August 4, 2019 at 6:25:55 PM UTC-6, Robert Engels wrote: >> >> I’m pretty sure they will be in the data section, for non interface/pointer >> types which is even better than the stack. >> >> > -- > 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/96d1c669-a65c-48ad-9ac1-17663e20c416%40googlegroups.com. -- 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/CAMV2RqoVmnY%2B-n1-jgtdbq9TizaciAm3e7Wp%3DwENr3NZbtBnmw%40mail.gmail.com.