The code below extracts data from one web page - I emulate search, select all results from the list and when the list appears (42000 items) I loop through these items.
I get an id value from their href to create a proper link (example
The main reason that I post this code is a memory issue. From all my testing here is what happens:
iexplore.exeprocess starts for the main result page, with a helper 32 bit
- memory used by
iexplore.exe*32 increases up to 308 MB and when result page is fully loaded, it remains +/- 2MB constant through whole extraction process;
- when a popup window (subpage for each result) is open, another
iexplore.exe*32 opens, but unlike in the previous process, its memory usage never stops increasing, despite
set PopupWindow = nothing;
- a third
iexplore.exeprocess starts once first pop-up window is open, it has a constant memory usage around 24 MB. I have a problem understanding why such process appears at all;
- each time I have scraped around 6000 elements, IE automation error appears. I have concluded that maybe it's because at this point all
iexplore.exe*32 processes together consume around 500MB of memory, maybe it's some limit.
- when I run this macro on other old PC, which has hardly any free RAM, automation errors appear usually around 10 times faster and therefore using this macro is impossible on that PC.
Is there any way to stop this increasing memory usage? Maybe I should set
IHTMLElement objects to nothing as well?
Are there any other things which could be upgrade efficiency / transparency of the code (apart from moving code to a module, applying multithreading and using XML)?