title: Static data memory limit in C++ application
body: <p>Someone has written function in our C++ application and is already in the production and I don't know why it's not crashing the application yet. Below is the code.</p>
  
  <pre><code>char *str_Modify()
  {
      char buffer[70000] = { 0 };
      char targetString[70000] = { 0 };
  
      memset(targetString, '\0', sizeof(targetString));
  
      ...
      ...
      ...
      return targetString;
  }
  </code></pre>
  
  <p>As you can see, the function is returning the address of a local variable and the allocated memory will be released once the function returns. 
  My question</p>
  
  <ul>
  <li>Wanted to know what is the static data memory limit? </li>
  <li>What can be the quick fix for this code? Is it a good practice to make the variable <code>targetString</code> static?</li>
  </ul>