On Fri, Oct 31, 2003 at 08:40:10PM -0500, Koen van der Drift wrote:

> Well, I figured out why the program is crashing. The code is assigning 
> some very large arrays as a static variables, which are created before 
> main() is called. They use all available stack, which causes the crash. 
> If I decrease the size of the array, the program starts up, but I'm not 
> sure if the smaller array will cause some harm later on. Someone on a 
> newsgroup suggested to use compiler/linker settings that either move 
> the static variables to their own memory segment or increase the stack 
> size.

Static variables should be on the stack.  What do you mean by assigning
large arrays?  Are they declared at the top level in the C file?  These
should go into the data segment, and should even be allocated by the
executable itself.

Have you tried running gdb on the program to see if you can catch the
problem?  Gdb does break on main, so if it is truly happening before
that, you won't be able to catch it.

Another useful thing, run 'size progname' should give you info about the
sizes of the various segments the program is using.  Static variables
should show up here.

Dave


-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?   SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
Fink-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/fink-devel

Reply via email to