This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Stack frame size
- To: help-gcc at gnu dot org
- Subject: Re: Stack frame size
- From: "Johnny Favorite (it means \"Himalayan Whipsaw Lizard\")" <allen at snakebite dot com>
- Date: Sun, 28 Nov 1999 06:53:32 -0500
- Newsgroups: gnu.gcc.help
- Organization: http://extra.newsguy.com
- References: <384041CD.41C67EA6@cim.mcgill.ca>
- Xref: wodc7nx0 gnu.gcc.help:1988
Chin-Pun Teng, wrote:
> I need to compute a matrix with size 3000x3000. However, it seems that
> the C compiler cannot handle it. I got the following message:
>
> Stack frame size (82000048) larger than system limit (67108864)
Geez, you tried to create 82 megabytes' worth of data on the STACK? No
*wonder* it puked!
The answer is obvious: Don't create the variable on the stack. Get the
memory for the variable using malloc() instead. And you better be sure and
check for a NULL pointer afterwards, you are by no means guaranteed to have
82MB free memory at any point.