title: UNIX: What should be Stack Size (ulimit -s) in UNIX?
body: <p>How can I calculate the minimum Stack Size required for my program in UNIX, so that my program never get crashed.</p>
  
  <p>Suppose my program is </p>
  
  <pre><code>int main()
  {
           int number;
           number++;
           return 0;
  }
  </code></pre>
  
  <p>1) What can be the Stack Size requried to run for this program? How it is calculated ?</p>
  
  <p>2) My Unix system gives <code>ulimit -s 512000</code>. Is this value <code>512MB</code> really required for my small program? </p>
  
  <p>3) And what if I have a big program having Multithreads, some 500 functions, including some libraries, Macros, Dynamically allocated memory etc. How much Stack Size is required for that ?</p>