0

I've python script that launch threads (processes). Each thread launches a class instance with a selenium driver. Driver invokes FF profile to browse the web. After a selenium driver has completed its work I close driver:

self.driver.quit()

The geckodriver.exe turns to still stay in the RAM, consuming memory. See the Task Manager shot: enter image description here The problem is to remove it from RAM.

Deleting geckodriver.exe thru the command taskkill /F /IM geckodriver.exe works to kill all opened geckodriver.exe instances. That is not practical when working multi-threaded or running several script instances.

So, how to kill a particular geckodriver.exe instance (and not to stop another opened ones)? Probably we need to do smth. with PID (process ID):

(1) fetch particular process ID.

(2) close process in python by PID: Taskkill /PID 364 /F where 364 is the pid value.

Igor Savinkin
  • 4,366
  • 7
  • 30
  • 57
  • Possible duplicate of [Selenium : How to stop geckodriver process impacting PC memory, without calling driver.quit()?](https://stackoverflow.com/questions/47999568/selenium-how-to-stop-geckodriver-process-impacting-pc-memory-without-calling) – DebanjanB Mar 12 '18 at 14:33
  • @DebanjanB, thanks. But the answer there: `taskkill /F /IM geckodriver.exe` works to remove all `geckodriver.exe` instances, killing still needed processes. – Igor Savinkin Mar 12 '18 at 14:37
  • this might also be related to [this](https://stackoverflow.com/questions/21320837/release-selenium-chromedriver-exe-from-memory/21320949#21320949) – ddavison Mar 12 '18 at 14:58

0 Answers0