Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

165
Views
Generating and downloading hundreds of files in Javascript - How to prevent memory leaks?

I'm dynamically generating multiple ~2mb files and downloading them in sequence for an internal application. The code works but when it reaches about 55 images the page stops and gives me a "status breakpoint" error.

I went to the memory tab in the chrome devtools and saw that at every loop the memory footprint increases, so I believe the blobs being generated are not being disposed for some reason.. here's my code:

  capturer.save(blob => {
    // const link = document.createElement("a");
    let downloadURL = URL.createObjectURL(blob);
    downloader.href = downloadURL;
    downloader.download = currentImage + ".gif";
    downloader.dispatchEvent(new MouseEvent("click"));

    URL.revokeObjectURL(downloadURL);
    URL.revokeObjectURL(blob);
    // tried these, no effect

    if (startImage< endImage) {
      setTimeout(() => {
        this.imageExport(++startImage, endImage);
      }, 0);
    }
  });

As you can see, I was initially creating elements dynamically but then I commented it out and added a single downloader element to test, didn't work. I believe the blobs are piling up on the memory and I can't find a way to dispose them.

Any ideas? I've been trying to fix this for hours now.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!