Chromedriver memory leak

404 views
Skip to first unread message

R J

unread,
Jun 30, 2021, 4:03:00 AM6/30/21
to ChromeDriver Users
Hello,

my chromedriver blocks 2-4 megabytes for each opening of the driver / url, which leads to a memory leak during massive unit tests.

Following command frees the issue
echo 3 | sudo tee /proc/sys/vm/drop_caches  
 
Env:
Driver.quit() is executed...
Chromedriver 91
Used Windows WSL

Are there any threads or fixes for this?

TestCode following:
const chrome = require('selenium-webdriver/chrome.js')
const sd = require('selenium-webdriver')
const Builder = sd.Builder
const Capabilities = sd.Capabilities

async function getDriver() {
    const service = new chrome.ServiceBuilder("./selenium/chromedriver");
    const options = new chrome.Options();
    const chromeCapabilities = Capabilities.chrome()
    const driver = new Builder()
        .withCapabilities(chromeCapabilities)
        .setChromeService(service)
        .setChromeOptions(options)
        .build();

    return driver;
}

async function Main(){
    const url = "http://127.0.0.1"
    for (let i = 0; i < 1000; i++) {
        const driver =  await getDriver()
        await driver.get(url);
        driver.quit()
    }
}
Main()
Greetings

Алексей Свириденко

unread,
Jan 12, 2023, 4:07:40 AM1/12/23
to ChromeDriver Users
Hi, did you solved this problem? I am facing with same thing sometimes and chromedriver gets more than 1GB memory.
photo_2023-01-12_00-50-48.jpg
среда, 30 июня 2021 г. в 11:03:00 UTC+3, R J:

R J

unread,
Jan 12, 2023, 8:49:30 AM1/12/23
to Алексей Свириденко, ChromeDriver Users
Hi,

Not really, but the memory handling of Linux do this automatically for me I got the same runtime if I had unlimited memory as well I used a test system with only 100mb memory.

But to use and work on my dev environment further you can regular clear your cache manually or coded  in Linux wsl.windows Subsystem via 

echo 3 | sudo tee /proc/sys/vm/drop_caches
--
You received this message because you are subscribed to a topic in the Google Groups "ChromeDriver Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/chromedriver-users/H9aL0mYXAk0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to chromedriver-us...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/chromedriver-users/49c14f68-e631-4b26-a36e-420491c197ean%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages