selenium: [🐛 Bug]: Possibly a huge memory leak?

What happened?

I’ve noticed that my automation tool started throwing tab crashed a few weeks ago. After doing some troubleshooting I’ve concluded it’s something that selenium is doing behind the scenes.

I’ve tried the same scenario with playwright and I didn’t have any memory leaks whatsoever. Browsing the site in a “normal” Chrome browser has no issues.

What I mean by memory leaks - just refreshing the page makes the tab have a 2GB+ memory footprint (looking at the Chrome task manager) in just a few minutes.

UPDATE 2024/01/25: Tried reproducing this on other pages (in my case 9gag.com). Just refreshing the page makes the memory footprint go up by ±50mb. And the footprint doesn’t go down. Even after waiting 2 minutes, it stays up in the high 600s. Trying this on a normal Chrome browser doesn’t do that. Goes up to ±500mb and instantly goes down to 300mb.

How can we reproduce the issue?

from selenium import webdriver
import time

driver = webdriver.Chrome()
driver.get("9gag.com")

time.sleep(3600)

Relevant log output

Nothing I've seen in debug logs is relevant to this issue.

Operating System

Windows 11, Sonoma 14.2.1

Selenium version

Python 3.11.5, Python 3.9.5, Selenium 4.17.2

What are the browser(s) and version(s) where you see this issue?

Chrome 121 (this issue appeared since 119)

What are the browser driver(s) and version(s) where you see this issue?

ChromeDriver 121.0.6167.85 (this issue appeared in 119)

Are you using Selenium Grid?

No response

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 17 (2 by maintainers)

Most upvoted comments

@peppelongo96 hey, I’ve just gone with the beta (v122) at this moment. Specify binary_location, get the beta chromedriver and you should be fine.