This piece of code will leak memory and eventually crash your Node.js process or browser:
It takes a while to fill GBs of heap, plus Node is less conservative, the GC eventually freezing the process trying to recover memory, so give it a few seconds. Chrome will crash it faster.
This is equivalent with this
Of course, if this loop would be synchronous, not using
... read the whole story at alexn.org.