help-gplusplus
[Top][All Lists]
Advanced

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

Re: stack size


From: Robert Heller
Subject: Re: stack size
Date: Tue, 13 Jul 2004 00:24:05 +0200

  "Chris" <chrisNOSPAM@noswisscomspam.com>,
  In a message on Mon, 12 Jul 2004 17:12:22 +0200, wrote :

"> Hi
"> 
"> I have a C program that has a stack overflow problem.
"> There is no recursivity, but I'm using some too big arrays of structures...

Declare the arrays 'static' and not automatic.  As a generally rule, the
stack size is generally 'small'.  And generally, you probably should
leave it small.  If there was recursion, I'd recommend that you allocate
the arrays of structures (eg with malloc()/free() or new/delete).

Declaring the array of structs static also helps protect from some cases
of buffer overrun bugs & exploits (I/O should always use fgets() rather
than gets(), etc.).

"> 
"> What is the default stack size?
"> Is it possible to increase it? What would be the command?
"> 
"> Bye
"> Chris
"> 
"> 
">                                                                              
                                                 

                                     \/
Robert Heller                        ||InterNet:   heller@cs.umass.edu
http://vis-www.cs.umass.edu/~heller  ||            heller@deepsoft.com
http://www.deepsoft.com              /\FidoNet:    1:321/153








         


reply via email to

[Prev in Thread] Current Thread [Next in Thread]