Storing a large tree in node.js

Solution for Storing a large tree in node.js
is Given Below:

I am testing tree search algorithms in node.js. The trees are just objects (representing nodes on the tree) that contain arrays of references to their ‘child’ nodes.

However, I am finding that I am often running out of memory. I’ve only eye-balled task manager before it crashes, but it seems to top out at 2gb.

What language features and options should I use to fix this? I know about buffers. Could I perhaps stores subtrees in multiple buffers? However a buffer is essentially an array right?