45a Subj : Segmentation fault with multi threads - Stack limitation?! To : comp.programming.threads From : Mike Date : Mon Apr 11 2005 12:40 am Hi, I wrote a simple program that basically do the following: void* thread_work(void*); class Data; class ThreadData { public: std::list container; }; int main() { ThreadData tdata[NTHREADS]; for (int i=0 ; i < NTHREADS ; ++i) { void* pd = (void*)(&tdata[i]); CreateThread(i,pd); } for (int i=0 ; i < NTHREADS ; ++i) { WaitToThread(i); } } The problem is as follow: 1. If I run this program with NTHREADS==4 then it works fine (thread_work do a lot of insertion and removal to the container). 2. If I run it with NTHREADS==5 then I get segmentation fault while doing insert to the container. It happens realy fast, meaning I don't reach large number of insertion/removal... 3. If I move the tdata array (which currenlty is on the stack of main) and put it globally (out of main) it works fine again. What can cause this failure? How to verify? Thanks, Uri. . 0