[🐛 Bug]: Memory Leak Issue Report
What happened?
# Memory Leak Issue Report
## Environment Information
- **Chrome Version**: 129.0.6668.59
- **ChromeDriver Version**: 129.0.6668.58
- **Operating System**: [Please specify your operating system]
## Steps to Reproduce
1. Open Chrome and enable DevTools.
2. Use the following code snippet to continuously perform the find operation:
```python
while True:
driver.find_element(By.CLASS_NAME, "menu")
Issue Description
After repeatedly calling the find_element method, memory usage rapidly increases, eventually causing the browser to crash. The following string appears continuously:
"(function(){ return (function() { // Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
/**
* Enum for WebDriver status codes.
* @enum {number}
*/
const StatusCode = {
STALE_ELEMENT_REFERENCE: 10,
JAVA_SCRIPT_ERROR: 17,
NO_SUCH_SHADOW_ROOT: 65,
DETACHED_SHADOW_ROOT: 66
};
/**
* Enum for node types.
* @enum {number}
*/
const NodeType = {
ELEMENT: 1,
DOCUMENT: 9,
};
/**
* Dictionary key to use for holding an element ID.
* @const
* @type {string}
*/
var ELEMENT_KEY = 'ELEMENT';
/**
* Dictionary key to use for holding a shadow element ID.
* @const
* @type {string}
*/
const SHADOW_ROOT_KEY = 'shadow-6066-11e4-a52e-4f735466cecf';
const W3C_ELEMENT_KEY = 'element-6066-11e4-a52e-4f735466cecf';
/**
* True if using W3C Element references.
* @const
* @type {boolean}
*/
var w3cEnabled = false;
/**
* True if shadow dom is enabled.
* @const
* @type {boolean}
*/
const SHADOW_DOM_ENABLED = typeof S"
Expected Result
Memory usage should remain stable during normal usage of WebDriver, and the browser should not crash.
Actual Result
After some time, memory usage spikes dramatically, leading to the eventual crash of the browser.
Additional Information
- Please provide any logs or details that may be needed.
Thank you for your efforts, and I look forward to your feedback!
Feel free to copy and paste this Markdown content!
### How can we reproduce the issue?
```shell
while True:
driver.find_element(By.CLASS_NAME, "menu")
Relevant log output
None
Operating System
Windows 11
Selenium version
ChromeDriver Version**: 129.0.6668.58
What are the browser(s) and version(s) where you see this issue?
Chrome Version**: 129.0.6668.59
What are the browser driver(s) and version(s) where you see this issue?
ChromeDriver Version**: 129.0.6668.58
Are you using Selenium Grid?
No response
@ChimeraFlutter, thank you for creating this issue. We will troubleshoot it as soon as we can.
Info for maintainers
Triage this issue by using labels.
If information is missing, add a helpful comment and then I-issue-template label.
If the issue is a question, add the I-question label.
If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.
If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C),
add the applicable G-* label, and it will provide the correct link and auto-close the
issue.
After troubleshooting the issue, please add the R-awaiting answer label.
Thank you!
What process is using the memory? Have you checked that?
@diemol
The memory in the picture will continue to increase and the speed will be very fast.
The snapshot shows a large number of strings being generated.
Is that the Chrome browser?
Is that the Chrome browser?
Yes
Then please report it to the Chrome folks.
Hi, @ChimeraFlutter. This issue has been determined to require fixes in ChromeDriver.
You can see if the feature is passing in the Web Platform Tests.
If it is something new, please create an issue with the ChromeDriver team. Feel free to comment the issues that you raise back in this issue. Thank you.
This issue has been automatically locked since there has not been any recent activity since it was closed. Please open a new issue for related bugs.