POSIX does not define any standards regarding stack size, it is entirely implementation dependent. Since you tagged this OSX
, the default allocations there are :
- Main thread (8MB)
- Secondary Thread (512kB)
Naturally, these can be configured to suit your needs. The allocation is dynamic :
The minimum allowed stack size for secondary threads is 16 KB and the stack size must be a multiple of 4 KB. The space for this memory is set aside in your process space at thread creation time, but the actual pages associated with that memory are not created until they are needed.
There is too much detail to include here. I suggest you read :