title: how to prevent memory leak in javascript
body: <p>i stuck into memory leak in js problems.</p>
  
  <p><strong>Javascript:</strong></p>
  
  <pre><code>var index = 0;
  function leak() {
      console.log(index);
      index++;
      setTimeout(leak, 0);
  }
  leak();
  </code></pre>
  
  <p>here is my test codes, and i use instruments.app to detect memory use of it,
  and the memory is going up very fast.</p>
  
  <p>i am doubt that there seems no variables occupy the memory.</p>
  
  <p>why?</p>
  
  <p>any thought is appreciate.</p>