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

268
Visualizações
Do I have to delete the node or the garbage collector does the work in JS?

To delete the last node of the circular link list in JS, I will traverse to the second last node and I will link the second last node with the first node, the last node is now disconnected from the chain. Now is it necessary to delete the last node like in c++, doesn't garbage collector of JS does the work ?

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

0

JavaScript handles freeing memory through the use of the garbage collector. As long as there are no longer any references pointing to an object, where all references have moved out of scope, it will be garbage collected. You don't need to worry about freeing memory yourself.

One thing to note in your use case is the limitation of circular references. Specifically when you have a situation where object A references object B, A->B; and object B references object A, B->A. Even if both A and B move out of scope and nothing else references them, they will not be garbage collected as both object still have "1 reference" from eachother.

I believe "most" modern browsers and runtime environments now support Mark & Sweep, and if they're not accessible should also be garbage collected, solving this issue.

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