title: What happens to the memory of my aborted object?
body: <p>I have a class "Texture", that in its constructor checks for illegal values entered by the user. If the user enters an illegal value, the constructor throws one of two exceptions, and execution breaks out of the constructor and into the relevant catch block. See the code below:</p>
  
  <pre><code>SSViewer::SSViewer(System::Windows::Forms::Form ^ parentForm, GLsizei iWidth, GLsizei iHeight) : COpenGL(parentForm,iWidth,iHeight)
  {
      printf("\nSuper inherited COGL const func GO");
      cbColour = gcnew array&lt;GLfloat&gt;(4); 
      cbColour[0] = 0.7f;
      cbColour[1] = 0.2f;
      cbColour[2] = 0.6f;
      cbColour[3] = 0.4f;
      //Test Texture
      try
      {
          //Test Texture
          Texture* myTex = new Texture("C4 Games 2.png");
      }
      catch(Texture::nonPOTException&amp; e)
      {
          System::String^ err = gcnew System::String(e.what());
          MessageBox::Show(err, "Sprite Sheet Error", MessageBoxButtons::OK, MessageBoxIcon::Stop);
      }
      catch(Texture::InvalidSizeException&amp; e)
      {
          System::String^ err = gcnew System::String(e.what());
          MessageBox::Show(err, "Sprite Sheet Error", MessageBoxButtons::OK, MessageBoxIcon::Stop);
      }
  }
  </code></pre>
  
  <p>The line:</p>
  
  <pre><code>Texture* myTex = new Texture("C4 Games 2.png");
  </code></pre>
  
  <p>is the line that will throw the exception. However if it does throw, the control is returned to the catch block before construction of myTex is complete. Obviously I do not want this incomplete, illegally initialised instance of Texture* to exist. </p>
  
  <p>What I wish to know is in the event that construction aborted by the throw, is the memory used for the incomplete instance still in use. Do I need to call <code>delete</code> on myTex in the catch-blocks to free up the memory?</p>