On Samstag, 29. November 2008, Stefan Lucke wrote:
Hi,
Hi Stefan!
the attached program segfaults when using a larger local variable.
Depending on used value I get segfaulst at different locations.
//#define BUFSIZE (9*1024*1024-16*1024) // only segfault #define BUFSIZE (8*1024*1024-16*1024) // hello + segfault //#define BUFSIZE (8*1024*1024-32*1024) // hello + 2nd line
When using last definition of BUFSIZE every thing is fine.
I guess linux has some limit on the stack-size. Sounds like 8MB in your case. But why can't you just alloc large data on the heap with malloc as everyone else does?
Regards Matthias