Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

166
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda