title: Does JavaScript setInterval() method cause memory leak?
body: <p>Currently developing a JavaScript based animation project.</p>
  
  <p>I have noticed that, proper use of <code>setInterval()</code>, <code>setTimeout()</code> and even <code>requestAnimationFrame</code> allocates memory without my request, and causes frequent garbage collection calls. More GC calls = flickers :-(</p>
  
  <p>For instance; when I execute the following <strong>simple code</strong> by calling init() in Google Chrome, memory allocation + garbage collection is fine for the first 20-30 seconds...</p>
  
  <pre><code>function init()
  {
      var ref = window.setInterval(function() { draw(); }, 50);
  }
  
  function draw()
  {
      return true
  }
  </code></pre>
  
  <p>Somehow, within a minute or so, starts a strange increase in allocated memory! Since init() is called only for once, <strong>what is the reason for the increase in allocated memory size?</strong></p>
  
  <p><strong>(Edit: chrome screenshot uploaded)</strong></p>
  
  <p><img src="https://i.stack.imgur.com/TNuct.png" alt="chrome screenshot"></p>
  
  <p>NOTE #1: Yes, I have tried calling clearInterval() before the next setInterval(). Problem remains the same!</p>
  
  <p>NOTE #2: In order to isolate the problem, I'm keeping the above code simple and stupid.</p>