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.

How to close or get rid of blank page which consumes unused memory

See original GitHub issue

Hey, when I tried your example code in headless:false mode it opens a blank page which is idle and stays until the task are completed. And if the task goes on for a long time this blank page is observed to use around 600 Mb. How can I get rid of that blank page since it consumes some memory ?

Here is your example code which reproduces this issue

const { Cluster } = require('../dist');

(async () => {
    // Create a cluster with 2 workers
    const cluster = await Cluster.launch({
  puppeteerOptions: {
            headless: false,
            },
        concurrency: Cluster.CONCURRENCY_CONTEXT,
        maxConcurrency: 2,
    });

    // Define a task (in this case: screenshot of page)
    await cluster.task(async ({ page, data: url }) => {
        await page.goto(url);

        const path = url.replace(/[^a-zA-Z]/g, '_') + '.png';
        await page.screenshot({ path });
        console.log(`Screenshot of ${url} saved: ${path}`);
    });

    // Add some pages to queue
    cluster.queue('https://www.google.com');
    cluster.queue('https://www.wikipedia.org');
    cluster.queue('https://github.com/');

    // Shutdown after everything is done
    await cluster.idle();
    await cluster.close();
})();

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
quetzalslycommented, Feb 13, 2020

Please don’t do this because then puppeteer-extra will not work properly! They only apply hooks on new pages not existing ones.

https://github.com/berstend/puppeteer-extra/issues/88

1reaction
thomasdondorfcommented, Feb 11, 2020

Yes, good point. This part could be improved by using the first (already open) page instead of opening another one…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Delete a blank page - Microsoft Support
You can get rid of a trailing blank page by saving the document as a PDF, leaving out the last page. Go to...
Read more >
How To Stop RAM Usage in Windows 10 (Prevent High Usage)
Here are a few effective ways to stop high RAM usage in Windows 10: Close unused background programs. Disable startup programs.
Read more >
7 Ways to Clear Memory and Boost RAM on Windows
1. RAM Hogs: Low Hanging Fruit · 2. Clean Up Startup Programs · 3. Clear Page File at Shutdown · 4. Check for...
Read more >
How to Delete a Page in Word – Remove Blank or Extra Pages
You can also remove this extra blank page by simply pressing the BACKSPACE key. Conclusion. In this article, you learned how to remove...
Read more >
How to delete a localStorage item when the browser window ...
Use localStorage.clear(); if you want to clear whole storage. – Black Mamba. Aug 12, 2017 at 6:40.
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