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

176
Vistas
Imported scripts not cleaned up from memory when Angular application is destroyed

I have an Angular application, and have noticed that when the page is closed (and application is destroyed) some script imports linger in memory. This is for instance what the Chrome's memory profiler tells me after I opened and closed my application twice since the last memory snapshot:

memory snapshot

As you can see, there are a couple of vendor.js elements in (compiled code) that are not accessible to the GC (distance is -).

Something that I found is that, if I manually remove the vendor.js script tag (i.e. I open the Elements tab in the dev tools, then hit Del to remove the script tag), then close the app, there is no memory leak anymore.
However, if I try to remove the script tag from the console (using for instance document.body.getElementsByTagName('script')[1].remove() which targets the correct script), I get a memory snapshot diff looking like the following:

enter image description here

enter image description here

So I guess my questions are:

  1. What is happening here? Why are the scripts not properly cleaned up when closing the window?
  2. Why is there a difference between manually removing the DOM script node in the dev tools vs doing it via javascript?
  3. Is there a solution?

I didn't find much on the web. I came across these:

  • https://github.com/angular/angular/issues/17637#issuecomment-387801113, but the solution proposed didn't do anything
  • as well as the things suggested there: https://github.com/angular/angular/issues/17637#issuecomment-351094525
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