On Mon, Aug 5, 2019 at 8:47 AM B Carr <buc...@gmail.com> wrote:
>
> Is it safe to say that environment variables (accessible to all goroutines) 
> also live in the data segment?

No.

When you say "environment variables", do you mean OS env variables, or
the variables visible to a goroutine?

If you're talking about the variables visible to a goroutine, where
the variable lives depends on how it is declared and allocated.

If the variable is allocated at compile time (like a global var/struct
initialized with a literal) it lives in data segment.

If the variable is allocated dynamically using new(), or it is
declared in a function and it escapes, it lives on the heap.


>
> --
> 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/01cea3eb-8f87-4ee3-a306-6641697c8a48%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/CAMV2Rqoc0GSo8GnOtU-LnB%2B71rdk7Aiz-PVSdia%2B7DYH5T-Z4g%40mail.gmail.com.

Reply via email to