3 ms·
Goroutines use segmented stacks that allows them to grow dynamically as needed. so 4k goroutines != 4gb of ram. They currently start at 8k and grow as needed bu
by halayli 10y ago
Goroutines use segmented stacks that allows them to grow dynamically as needed. so 4k goroutines != 4gb of ram. They currently start at 8k and grow as needed but copies are incurred to keep it contiguous.
In lthread I preallocate fixed size 1mb stack but madvise after a coroutine yields if the stack shrunk. No copies are needed but it does consume the vm address space.
- ominous_prime 10y agoGo hasn't used segmented stacks in quite a while. Go now has 2k stacks and uses stack copying to grow.
- deleted 10y ago[deleted]