Azitech

Azimout's Linux weblog

stack overflow

leave a comment »

If you have large arrays as local variables in your code, you risk overflowing the stack. You can find out your stack size (allocated to each thread) by running ulimit -s; typically it will be 8MB.

The way around this is to declare the arrays as static, or move them out of a function (make them global).

Other ways around it are:

Reference: http://stackoverflow.com/questions/851122/large-2d-array-gives-segmentation-fault

Advertisements

Written by azimout

21/06/2010 at 14:49

Posted in Problems

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: