question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

system memory usage increase surprisingly with headless chrome

See original GitHub issue

Steps to reproduce

Tell us about your environment:

  • Puppeteer version: puppeteer@1.6.1
  • Platform / OS version: Linux/CentOS 7.5.1804
  • Node.js version: v8.11.3

What steps will reproduce the problem?

Please include code that reproduces the issue.

1.launch 16 chromes 2.160 node processes connect 16 chromes randomly, so, 10 node process connect/ per chrome 3.every node process:

(async() => {
    const browser = await puppeteer.connect({
        browserWSEndpoint: browseradd,
        ignoreHTTPSErrors: true,
    });
    const page = await browser.newPage();
    await page.goto(url,{timeout: 12000}).then( (value) => {
    }).catch( (error) => {
    });
    rlt['content'] = await page.content();
    console.log(JSON.stringify(rlt));
    page.close();
   process.exit();
})();

system memory usage increase surprisingly with time goes by. Only kill the main process can solve the problem

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
aslushnikovcommented, Jan 10, 2019

Are you suggesting to reuse browser object to save memory?

Definitely. Three thigns:

  • Browser instance should be re-used
  • Browser contexts should be re-created
  • Total amount of simultaneous browser contexts should be constrained with some reasonable number
1reaction
aslushnikovcommented, Oct 4, 2018

@lexy0093 Two things:

  1. await page.close so that you have a fine control on the amount of opened pages
  2. try using browser context per new page.
Read more comments on GitHub >

github_iconTop Results From Across the Web

Limit chrome headless CPU and memory usage
However it appears that chrome headless is consuming too much memory and cpu,anyone know how we can limit CPU/Memory usage of chrome ......
Read more >
Building headless for minimum cpu+mem usage
Did anybody find a workaround for this problem? Running headless chrome is consuming too much CPU+Memory resources and we need to restart our...
Read more >
[2023] How to Reduce Chrome High Memory Usage Windows ...
7 Quick Ways to Reduce Chrome High Memory Usage Windows 10/11 · Open Google Chrome browser. · Type chrome://extension on the address bar....
Read more >
MemLab: An open source framework for finding JavaScript ...
We've open-sourced MemLab, a JavaScript memory testing framework that automates memory leak detection. Finding and addressing the root cause ...
Read more >
Observations running more than 5 million headless sessions a ...
When running headless chrome, especially with puppeteer, it's really easy ... and loves to use equal parts CPU and memory for most things....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found