title: Garbage Collection and JavaScript "delete": Is this overkill/obfuscation, or a good practice?
body: <p>I just read this question and the accepted answer:  <a href="https://stackoverflow.com/questions/864516/what-is-javascript-garbage-collection">What is JavaScript garbage collection?</a></p>
  
  <p>In the answer, <a href="https://stackoverflow.com/users/44389/noldorin">Noldorin</a> referenced some guidelines from Apple.  Here is the part I'm concerned with:</p>
  
  <blockquote>
    <p>Use delete statements. Whenever you create an object using a new statement, pair it with a delete statement. This ensures that all of the memory associated with the object, including its property name, is available for garbage collection.  </p>
  </blockquote>
  
  <p>I'm always taking time to keep up-to-speed on best practices, especially if I can reduce the memory footprint of my scripts.  So I went off to test some things.  If I understand correctly, the following is an example of an object that deletes itself after invoking a method.</p>
  
  <pre><code>var thing = function () {
      var a_method, and_another;
      a_method    = function() { /* do stuff */ };
      and_another = function() { /* do some other stuff*/ };
      this.init   = function() { a_method(); and_another(); };
  };
  delete new thing().init();
  </code></pre>
  
  <p>Usually I'll wrap everything in a self invoking function and pass in my globals just like above.  Everything is the same as I would normally do it, the only difference being that I added the <code>delete</code> right before the <code>new</code>.</p>
  
  <p>The code works either way.</p>
  
  <p>So the question is:  Am I doing <em>anything</em> here?  Is there some kind of benefit to deleting a reference to an object that only exists inside a function scope?  Or am I just making things look confusing?</p>