When the program exits, the operating system releases all the memory allocated to it. So the GC doesn’t need to bother with freeing the memory.
Andy > On May 3, 2019, at 5:49 PM, Matt Harden <[email protected]> wrote: > > On Fri, May 3, 2019, 17:28 <[email protected] <mailto:[email protected]>> > wrote: > Does Go GC destroy all global vars prior to the end of main() ? > > What do you mean by "destroy"? Go is not an object oriented language and > doesn't have the concept of a destructor. So no, it doesn't, but it also > doesn't need to. > > May I ask, what led you to ask this question? > > -- > 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 [email protected] > <mailto:[email protected]>. > For more options, visit https://groups.google.com/d/optout > <https://groups.google.com/d/optout>. -- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
