0

I am using below mentioned code for data extraction,this code is working fine for me when java scripts are disabled in Internet Explorer but when i enable scripts then Memory utilization is very high and increase after each url extraction.Suggestion require so that system will use very low memory.I use following code i.e set ie=nothing or ie.refresh2 but still same issue.

enter image description here

Ie.navigate url1234
Do While Ie.ReadyState <> 4 Or _
Ie.Busy = True
DoEvents
Loop
Set html = Ie.Document
html1 = html.body.innerHTML
tahir mehmood
  • 35
  • 1
  • 2
  • 8
  • anyone have some idea? – tahir mehmood Aug 10 '21 at 15:01
  • What's an example url? And what is your system set-up? – QHarr Aug 10 '21 at 16:42
  • example url is "www.amazon.com/dp/B07KVVKQ9T" and as for concern of system i am using vps.thanks. – tahir mehmood Aug 10 '21 at 17:51
  • did you check above link? – tahir mehmood Aug 11 '21 at 05:28
  • I test on a vm and the memory usage will be a little higher when script is enabled because running scripts also need to use memory. But it's just a little higher than script is disabled, I don't see it's very high. Could you explain more detailly how high it is in your scenario? It could be better if you can provide a screenshot of the issue. Besides, don't forget to add `IE.Quit`, `Set IE = Nothing` when you finish the automation. – Yu Zhou Aug 11 '21 at 09:46
  • Actually if we have urls in thousands for extraction then with the passage to time Memory and CPU utilization is very high and finally almost not responding. – tahir mehmood Aug 11 '21 at 17:11
  • I think it's reasonable that the Memory and CPU utilization is high when you're operating **thousands of urls**. It also be related with your vps configuration. If you need to work with thousands of urls in vba, I think you need a high configuration and high performance vps. Besides, try to optimize your code to avoid operating all the urls at a time. – Yu Zhou Aug 13 '21 at 10:06
  • But why no high usage without enabling scripting? – tahir mehmood Aug 15 '21 at 09:38
  • Because executing scripts needs to use Memory and CPU. If you disable scripting, it will save a lot of Memory and CPU usage especially you're operating thousands of urls. – Yu Zhou Aug 16 '21 at 06:44
  • so Is this possible that after each request all usage will be cleared,I use set html=nothing etc but usage is same.thanks. – tahir mehmood Aug 16 '21 at 10:11
  • `Set obj = Nothing` seems not always work. I have no other ideas, but for clearing memory methods, you can also refer to [this thread](https://stackoverflow.com/questions/14396998/how-to-clear-memory-to-prevent-out-of-memory-error-in-excel-vba). – Yu Zhou Aug 17 '21 at 09:45

0 Answers0