// Initialization
///////////////////////////////////////////////////////////////////////////
+ version (Windows)
+ // exception handling walks the stack, invoking DbgHelp.dll which
+ // needs up to 16k of stack space depending on the version of DbgHelp.dll,
+ // the existence of debug symbols and other conditions. Avoid causing
+ // stack overflows by defaulting to a larger stack size
+ enum defaultStackPages = 8;
+ else version (OSX)
+ {
+ version (X86_64)
+ // libunwind on macOS 11 now requires more stack space than 16k, so
+ // default to a larger stack size. This is only applied to X86 as
+ // the PAGESIZE is still 4k, however on AArch64 it is 16k.
+ enum defaultStackPages = 8;
+ else
+ enum defaultStackPages = 4;
+ }
+ else
+ enum defaultStackPages = 4;
/**
* Initializes a fiber object which is associated with a static
* In:
* fn must not be null.
*/
- this( void function() fn, size_t sz = PAGESIZE*4,
+ this( void function() fn, size_t sz = PAGESIZE * defaultStackPages,
size_t guardPageSize = PAGESIZE ) nothrow
in
{
* In:
* dg must not be null.
*/
- this( void delegate() dg, size_t sz = PAGESIZE*4,
+ this( void delegate() dg, size_t sz = PAGESIZE * defaultStackPages,
size_t guardPageSize = PAGESIZE ) nothrow
in
{