title: Using JavaScript with Internet Explorer, how do I clear memory without refreshing the page?
body: <p>I have an AJAX-based website using JavaScript on the client.  Certain operations on the site cache large result sets from service calls in the browser (i.e. hundreds of megabytes).  These are throw-away results.  They will be viewed for a short time and then need to be cleared from memory.  </p>
  
  <p>I've written a small test site that loads a bunch of junk in memory and then calls JavaScript's <code>delete</code> method.  This works great in Firefox (memory almost instantly gets returned).  Internet Explorer 8 (haven't tried 7) doesn't free the memory until the page is refreshed or closed.  </p>
  
  <p>Does anyone know how to drop IE's memory usage using JavaScript/Ajax (no page refreshes)?</p>
  
  <p>Below is my sample client code:</p>
  
  <pre><code>function load() {
   var x = ['dfjasdlfkjsa;dflkjsad;flkjsadf;lj'];
  
   for( var i = 0; i &lt; 10000000; ++i ) {
    x.push('asdfasfasfsfasdfkasjfslafkjslfjsalfjsaldfkjasl;dfkjsadfl;kjsdflskajflskfjslakfjaslfkjsaldfkjsaldfksdfjk');
   }
  
   alert('deleting');   // &lt;--- memory usage around 500mb
   delete x;            // &lt;--- immediate results in Firefox 3.5 (not IE8)
   alert('done');
  }
  </code></pre>
  
  <p><strong>UPDATE:</strong> Setting the variable to 'null' does not immediately clear the memory (as that is left up to the garbage collector).  Also, setting a variable null only gets a single reference where there might be multiple references.</p>