Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

212
Visualizações
Worker objects are not freed

I am noticing that in both Google Chrome and Microsoft Edge the Worker objects are not garbage collected. After running the following standalone simple test case, doing memory profile and checking for Worker class shows all the worker objects as retained.

<html>
        <body>
                <div id="app"></div>
                <script>
                        const js = 'var array = new Array(1024*1024).fill("Hello world")';
                        const blob = new Blob([js], { type: 'application/javascript' });
                        const wurl = URL.createObjectURL(blob);
                        for(let i=1;i<=100;i++) {
                                const w = new Worker(wurl);
                                const result = { id: i };
                                document.getElementById('app').innerHTML = JSON.stringify(result);
                                w.terminate();
                        }
                </script>
        </body> 
</html>

How to ensure the worker objects are freed?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Off the top of my head I'd say that your problem lies with the const w = new Worker... part. I'm guessing the garbage cleanup isn't taking because the value of w cannot be reassigned, and in any case block cleanup is irrelevant because it's a detached process to begin with. Try changing it to var w = new Worker..., leaving the rest unchanged.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda