Phantomjs - huge memory usage

I am using selenium with phantom -js web driver in a linux virtual machine. since each phantom instance is consuming too much memory, after three instances the virtual machine crashes and I have to restart the machine.

top command

is there a way to ensure that the virtual machine doesn't crash or reduce the huge phantom memory usage?

service_args = [
                    '--ignore-ssl-errors=true',
                    '--proxy=' + proxyIP + ':' + str(proxyPort),
                    '--proxy-type=http',
                    ]
self.browser = Browser(driver_name="phantomjs", service_args=service_args)

      

+3


source to share


1 answer


after researching i found that phantomjs can cause memory leaks. As far as I understand, a better solution is to check the phantom memory usage every time interval and if it exceeds the threshold than closing the phantom and reopening it again. what is the best solution i could find to solve the problem at the moment.



+2


source







All Articles