Javascript - heap out of memory in Rasberry Pi

I am using Node-RED on my Rasberry pi, where in the flow also contains Uibuilder. I am accepting some values from the user via UI and then generating a bar chart on the basis of the values entered by them. The flow also receives data about upper and lower limit of the data on the basis of job specified by user.

During all this, Node-RED gets crashed giving Heap out of memory error.

Is there a way where i can allot more memory to Node-RED using pi terminal?

There are several things you can do here.

The first would be not to run a desktop on the Pi if that is what you are doing. Unless you have a Pi4 with loads of memory, the Pi's are generally fairly short on memory and a desktop takes up a LOT.

Secondly, you should check how you are running Node-RED. In the past, a parameter was passed max-old-space which changes when Node.js performs its garbage collection. If you do have it, try removing it. If you don't have it, try adding it. For the old Pi's, we used to set it to 256.

There are quite a few threads here in the forum about memory management. Here are a couple but you should use the search function as well.

Help - how can I reduce memory footprint of node-red - General - Node-RED Forum (

Analysing Memory Use - FAQs - Node-RED Forum (

There are also a few nodes that help with this:

bartbutenaers/node-red-contrib-process-resources: A Node-RED node to monitor the resources used by the OS processes (

node-red-contrib-gc (node) - Node-RED (

There may be others, please do a search in the Flows site.

Another thing that you can do is to remove any contributed nodes that you don't really need.

And then you should check your flows for anything that might be either loading a really large chunk of data or that might not be releasing data.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.