You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We use libco for fibers which allocate their own stacks. That means we basically don't use the default stack for the main thread and the worker threads we spawn. I don't think there's a way to shrink the main thread once the process is already running, but we could cap the worker threads before we spawn them.
See also pthread_attr_setstacksize, PTHREAD_STACK_MIN
Not sure about portability. Could be POSIX-only for now.
Edit: This would save a little bit of address space but I guess the main advantage would be fragmentation? If the default stack space is 8MB and we spawn 16 worker threads, that's almost 128MB we're wasting (but the kernel VM means it's not as bad as it sounds).
Edit: It's a bigger deal on 32-bit.
The text was updated successfully, but these errors were encountered:
We use libco for fibers which allocate their own stacks. That means we basically don't use the default stack for the main thread and the worker threads we spawn. I don't think there's a way to shrink the main thread once the process is already running, but we could cap the worker threads before we spawn them.
See also
pthread_attr_setstacksize
,PTHREAD_STACK_MIN
Not sure about portability. Could be POSIX-only for now.
Edit: This would save a little bit of address space but I guess the main advantage would be fragmentation? If the default stack space is 8MB and we spawn 16 worker threads, that's almost 128MB we're wasting (but the kernel VM means it's not as bad as it sounds).
Edit: It's a bigger deal on 32-bit.
The text was updated successfully, but these errors were encountered: