Re: A simple program with a large array segfaults

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[redirected to gcc-help]

Gowri Kumar CH writes:
 > Hi andrew,
 > >You just overflowed your stack.  Increase the stack size for the program
 > > by using limit/ulimit or use dynamic allocated memory.
 > Thanks for the quick reply. By changing the size of the stack the
 > error goes away.
 > 
 > Is this one of the things which we come to know by experience?
 > Or
 > Is there a way to find it out from the core/code generated?
 > This was a simple program with just a few lines. I'm wondering how
 > difficult it would be find this sort of errors in a large program.
 > 

It's just something you learn not to do.  Small data on the stack,
large data on the heap.

Andrew.


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux