4 ms·
> This may be kind of a dumb question, but does Go use the stdlib C stack or are they talking about their own stack? Their own. > I'm assuming that Go has a s
by masklinn 12y ago
> This may be kind of a dumb question, but does Go use the stdlib C stack or are they talking about their own stack?
Their own.
> I'm assuming that Go has a standard / vanilla / kernel aware C-style stack living somewhere right?
Not unless it has to call into C, which would require a C-style stack.
> Then the stack they are referring to is part of their run time environment...which is actually allocated on the heap somewhere.
Yes, as it is in C really. The difference is that the C stack is bounded and "fairly limited" (and highly variable, from 16k to a few MB[0]).
[0] http://lists.gnu.org/archive/html/bug-coreutils/2009-10/msg00262.html http://lists.gnu.org/archive/html/bug-coreutils/2009-10/msg0...
- 4ad 12y ago> Yes, as it is in C really. Not really. What people understand by "the C stack" is the stack that automatically comes when new threads are created. This stack is not on the heap; in fact it's at the top of the user address space and it has some special properties, like the operating system setting guard pages for you. Pthreads allow you to set your own stack for a thread, but it is a feature seldom used; though it used by Go when cgo is employed.