title: VBA Macro Memory Leak (how to clear variable=
body: <p>I have a VBA Macro script that scrapes some data.
  It's scrapes it using MSIE.. I believe the MSIE is the core problem to the memory leakage.</p>
  
  <p>I'm initializing the variable like</p>
  
  <pre><code>Set IE = CreateObject("InternetExplorer.Application")
  </code></pre>
  
  <p>I made a little test to see how the memory is being used.</p>
  
  <p>I made a loop which makes only 1 instance of IE and pings the same website.
  Memory doesn't seem to leek.</p>
  
  <p>Then I made a loop which always ping a different site and memory usage started increasing with each request.</p>
  
  <p>I also made a test (I'm posting below) that creates NEW object in every iteration and deletes it on the end. The deleting part doesn't seem to work.</p>
  
  <p>It seems like the instance of IE is caching the requests so the object is getting bigger.
  This is just an assumption.</p>
  
  <p>Here's the sample code I used to test the leakage.</p>
  
  <pre><code>Do While True
      Dim IE As Object
      Set IE = CreateObject("InternetExplorer.Application")
  
      IE.Navigate "https://www.google.hr/#hl=hr&amp;gs_nf=1&amp;cp=3&amp;gs_id=8&amp;xhr=t&amp;q=" &amp; Counter
      IE.Visible = True
  
      Do While IE.readyState &lt;&gt; 4 Or IE.Busy = True
          Application.Wait Now() + TimeValue("00:00:01")
          DoEvents
      Loop
  
      Application.Wait Now() + TimeValue("00:00:01")
      Counter = Counter + 1
      Range("A" &amp; Counter).Value = "https://www.google.hr/#hl=hr&amp;gs_nf=1&amp;cp=3&amp;gs_id=8&amp;xhr=t&amp;q=" &amp; Counter
  
      IE.Quit
      Set IE = Nothing
  Loop
  </code></pre>
  
  <p>Any input would be great!</p>