@@ -4071,6 +4071,14 @@ class Fiber
4071
4071
// Initialization
4072
4072
// /////////////////////////////////////////////////////////////////////////
4073
4073
4074
+ version (Windows )
4075
+ // exception handling walks the stack, invoking DbgHelp.dll which
4076
+ // needs up to 16k of stack space depending on the version of DbgHelp.dll,
4077
+ // the existence of debug symbols and other conditions. Avoid causing
4078
+ // stack overflows by defaulting to a larger stack size
4079
+ enum defaultStackPages = 8 ;
4080
+ else
4081
+ enum defaultStackPages = 4 ;
4074
4082
4075
4083
/**
4076
4084
* Initializes a fiber object which is associated with a static
@@ -4087,7 +4095,7 @@ class Fiber
4087
4095
* In:
4088
4096
* fn must not be null.
4089
4097
*/
4090
- this ( void function () fn, size_t sz = PAGESIZE * 4 ,
4098
+ this ( void function () fn, size_t sz = PAGESIZE * defaultStackPages ,
4091
4099
size_t guardPageSize = PAGESIZE ) nothrow
4092
4100
in
4093
4101
{
@@ -4115,15 +4123,15 @@ class Fiber
4115
4123
* In:
4116
4124
* dg must not be null.
4117
4125
*/
4118
- this ( void delegate () dg, size_t sz = PAGESIZE * 4 ,
4126
+ this ( void delegate () dg, size_t sz = PAGESIZE * defaultStackPages ,
4119
4127
size_t guardPageSize = PAGESIZE ) nothrow
4120
4128
in
4121
4129
{
4122
4130
assert ( dg );
4123
4131
}
4124
4132
do
4125
4133
{
4126
- allocStack( sz, guardPageSize);
4134
+ allocStack( sz, guardPageSize );
4127
4135
reset( dg );
4128
4136
}
4129
4137
0 commit comments