B
B
BorisNaumov2020-09-01 02:03:35
Node.js
BorisNaumov, 2020-09-01 02:03:35

Do variables need to be nulled after use?

Can you please tell me whether it is necessary to reset const and let after use, for example, in a long-lived loop, to free memory after each iteration?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Robur, 2020-09-01
@BorisNaumov

in general, no. in general - give an example to start with. how many megabytes you are going to release by zeroing, for how long they "freeze" with you, what environment, what requirements, and a lot of everything else should be added up in order to basically make sense to think about this issue.
If you do not have memory leaks, then the garbage collector will collect everything unnecessary, and you still cannot "zero" everything you need.

D
Dmitry Belyaev, 2020-09-01
@bingo347

https://habr.com/ru/company/badoo/blog/454930/
here is not a bad article on modern GC in v8

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question