You don't like GC? Do you?

aberba karabutaworld at gmail.com
Thu Oct 11 21:22:19 UTC 2018


"It takes care of itself
-------------------------------
When writing a throwaway script that I will only use a handful of 
times, optimising that code isn’t necessarily high on my priority 
list. The priority is to get it written, and get it running. 
That’s where the V8 (C++) engine that NodeJS is compiled into 
throws you a bone.

When you have no choice but to call arrays into memory and 
manipulate them, sometimes very very large arrays, you can begin 
to worry about the state of your machine and the amount of memory 
that is being used. Luckily, V8 handles automatic garbage 
collection.

What this means is that whenever I have disregarded a block of 
information, say removed an index from an array, then that memory 
is automatically cleared and freed back up on the next sweep. 
While the process of collection and actually checking can be a 
bit intensive, it means when I am quickly iterating through code 
I don’t need to pay a tremendous amount of attention to my memory 
management, and I can entrust V8 to handle all the little 
nuances."

Don't be a computer. Do more with GC.

https://medium.com/@kieranmaher13/why-i-use-nodejs-for-basically-everything-i-do-e0a627787ecc


More information about the Digitalmars-d mailing list