title: Android NDK - try catch with NoMemoryError
body: <p>I have block of code, which in Android NDK allocates huge ammounts of memory. Last what I need is to use try - catch block for possibility, there might be NoMemoryError. Do you know how to write it in native SDK?</p>
  
  <p>I need to implement same functionality as this:</p>
  
  <pre><code>        for(int i=1;i&lt;50;i++){
          try{
              int[] mega =new int[i*1024*1024];//1MB
  
          }catch (OutOfMemoryError e) {
              usedMemory= (Runtime.getRuntime().totalMemory()-Runtime.getRuntime().freeMemory())/new Float(1048576.0);
              usedText=usedMemory+" MB";
              tw.setText(usedText);          
              break;
          }
      }
  </code></pre>