title: placement delete inside or outside destructor
body: <p>I found the following code while reading placement new operator.</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  class MyClass {
  
  public:
    // Placement new operator
    void* operator new (size_t sz, void* v) {
      cout &lt;&lt; "Placement new invoked" &lt;&lt; endl;
      return v;
    }
  
    ~MyClass() {
      // Cleanup
    }
  };
  
  int main()
  {
      // Create a buffer to store the object
      int buffer[16];
      cout &lt;&lt; "Starting address of my buffer = " &lt;&lt; &amp;buffer &lt;&lt; endl;
  
      // Create the object. Use placement new
      MyClass* obj = new (buffer) MyClass();
      cout &lt;&lt; "Location of my object = " &lt;&lt; obj &lt;&lt; endl;
  
      // Don't delete object created with placement delete
      // Call the destructor explicitly
      obj-&gt;~MyClass();
  }
  </code></pre>
  
  <p>I have few questions related to delete object which was created using placement new:</p>
  
  <ol>
  <li>what is the clean up code needs to write in destructor in order to
  free memory which was occupied obj in buffer memory.</li>
  <li>is it not needed to define placement delete, if yes whether it needs to be inside destructor or outside destructor. If it is outside destructor how it will be called ? </li>
  </ol>