title: How to measure a functions stack usage in C?
body: <p>Is there a way I can measure how much stack memory a function uses?</p>
  
  <p>This question isn't specific to recursive functions; however I was interested to know how much stack memory a function called recursively would take.</p>
  
  <p>I was interested to optimize the function for stack memory usage; however, without knowing what optimizations the compiler is already making, it's just guess-work if this is making real improvements or not.</p>
  
  <p><strong>To be clear, this is <em>not</em> a question about how to optimize for better stack usage</strong></p>
  
  <p>So is there some reliable way to find out how much stack memory a function uses in C?</p>
  
  <hr>
  
  <p>Note: Assuming it's not using <code>alloca</code> or <em>variable-length arrays</em>,
  it should be possible to find this at compile time.</p>