I'm getting crashes in my multi-threaded application which I suspect to be stack overflows (should be a nice site to ask this question) because I'm doing some pretty deep recursion and the crash doesn't happen with smaller orders of the problem. I'm using boost::thread. It offers the possibillity to set the stack size (in advance) via an attribute:
boost::thread::attributes l_ThreadAttributes;
l_ThreadAttributes.set_stack_size(8000000);
boost::thread l_MyThread(l_ThreadAttributes, l_MyFunctor);
I'm not very convinced that this actually works. If I ask the current stack size via the same attribute "get_stack_size()" I get 0. Does anyone have experience with it (I'm working on Windows 7 32-bit, Visual Studio 9 2008, boost_1_54_0)? Furthermore, how would this relate to the value I would put in the linker settings (Properties -> Linker -> System -> Stack Reserve Size -> 8000000 for instance)?
Is there a convenient way to check how much stack I have left at runtime (in the current thread)? The handy stackavail() function that used to be in malloc.h and/or stdlib.h seems to have vanished.
Thanks in advance, Daniel Dekkers