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

80
Visualizações
Does React clean used memory for States?

Suppose that, I should store a lot of data in component's local states with useState(). Logically React uses memory to store these data. But what does happen when one component unmount? Does React clean used memory for old states in unmounting step? or JavaScript keeps all states in memory until I close tab or refresh page?

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

0

React does nothing with the memory.

JavaScript manages memory allocation and deallocation by his own. This is known as garbage collection

Answering your question - in most cases JS will free the memory by himself when it's needed by removing not accessible objects.

However, sometimes you can prevent JS from freeing memory. This is known as memory leaks

If component use 1MB of memory for states, React will free all 1MB of memory after unmounting?

Most of all - no. Garbage collection will start in undermine moment, somewhere in the future

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