Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

phantomjs - enormous memory usage

I'm using selenium with phantom-js web driver on linux virtual machine. as it seems each instance of phantom is consuming too much memory, after three instances the virtual machine crashes and i must restart the machine.

top command

is there a way to guaranty that the virtual machine won't crashes or to reduce the enormous memory usage of phantom?

service_args = [
                    '--ignore-ssl-errors=true',
                    '--proxy=' + proxyIP + ':' + str(proxyPort),
                    '--proxy-type=http',
                    ]
self.browser = Browser(driver_name="phantomjs", service_args=service_args)
like image 848
omri_saadon Avatar asked Sep 08 '26 19:09

omri_saadon


1 Answers

after research, I found that phantomjs can cause memory leaks, from my understanding the best solution is to check the memory usage of phantom every interval of time and if it exceeds a threshold, than close the phantom and reopen again. that's the best solution I could find to workaround the problem for now.

like image 187
omri_saadon Avatar answered Sep 10 '26 18:09

omri_saadon