— But yes, they do have this problem in JS. V8 may do some magic to optimize this, but the bigger question is:
Why are you storing huge arrays in JS?
Message permanent page
— JS is not great for CPU-heavy operations
— It's perfect for streaming, data-heavy apps, and I/O
— In JS you generally don't want or need that much data in-memory at once
— What do you mean by streaming?
— Reading from disk, pushing to a socket
— Reading from a socket, pushing to another socket
— Pumping data through the app in chunks