A goroutine starts with a default stack size of 2 KB, which grows and shrinks automatically as needed. This dynamic allocation allows Go to run millions of goroutines efficiently without exhausting system memory. You can inspect the current stack size of a specific goroutine using the runtime.Stack function or by analyzing a heap profile.
How much memory does a goroutine use
Goroutines start with a 2 KB stack that grows and shrinks dynamically to optimize memory usage.