NodeRED crashing due to "Javascript out of heap memory" issue

Wow, ok that IS a lot!

It feels like you should be looking at how you can simplify things. Also, with that number of nodes, take care with debug nodes and places in your flows where you have >1 wire connected to the output of a node. That's because having multiple wires on an output causes Node-RED to have to CLONE the output messages which is a relatively heavy task.