4 ms·
I was going to ask, how does Node then know to free the string when all JS pointers to it are gone? ... guess it doesn't?
by wging 9y ago
I was going to ask, how does Node then know to free the string when all JS pointers to it are gone?
... guess it doesn't?
- webkike 9y agoWhen the program exits memory will be reclaimed by the kernel. Memory leaks aren't horrible if they don't appear in loops or recursive functions (that is to say the leaked allocations do not grow with the uptime of the program). In this case it's pretty much identical to allocating memory that has the lifetime of the program. Pretty obvious stuff but it's important to keep in mind.