> Can we avoid stack overflows by splitting recursion to multiple
> threads?
In a few cases, yes, but it's probably not a good soluition.
The default stack size is 2mb. If you're recusing so deeply that you're
consuming 2mb of stack space, there's probably something wrong with your
design. You could just make the stack bigger (if you create a new thread),
but if you're consuming 3mb with today's test case, who's to say that you
won't need 4mb tomorrow? or 10mb or 100mb?
I really wouldn't expect the code you posted to have any problems with
exhausting the stack space - it should be consuming only a few (two dozen?)
bytes of stack per recursion.
-cd
Willy Denoyette [MVP] - 19 May 2005 08:46 GMT
>> Can we avoid stack overflows by splitting recursion to multiple
>> threads?
[quoted text clipped - 12 lines]
>
> -cd
Carl,
Sorry to correct you, but the default stack for thread/fibers in Win32 is
1MB, check the CreateThread API ins the SDK docs.
Willy.
Ioannis Vranos - 19 May 2005 10:01 GMT
Thank you all for the information, in the end the recursion problem was a bug in my code.
Carl Daniel [VC++ MVP] - 19 May 2005 14:42 GMT
> Carl,
>
> Sorry to correct you, but the default stack for thread/fibers in
> Win32 is 1MB, check the CreateThread API ins the SDK docs.
Yep. No need to be sorry - I just misremembered and didn't bother looking
it up.
-cd