title: How do you clear memory in Javascript?
body: <p><code>var Obj = function(){}; var X = new Obj();</code> </p>
  
  <p>will <code>X = null</code> properly clear memory?</p>
  
  <p>Also would this be equivalent?</p>
  
  <pre><code>var Obj = function(){}; 
  var X   = {}; 
  X.obj   = new Obj();
  delete(X.obj);
  </code></pre>
  
  <p><strong>EDIT</strong> 
  It would seem that although deleting X.obj would NOT immediately clear memory, it would help the garbage collection. If I don't delete X.obj, there would still be a pointer to an object and so the GC may not clean it up.</p>
  
  <p>Although I'm picking @delnan's answer, if you're reading this you should def also catch Benubird's article.</p>
  
  <p>I also notice I accidentally wrote delete(X) originally instead of delete(X.obj) - sorry.</p>