Auto start corresponding to "node-red-pi --max-old-space-size=256"

IF you are running a RaspberryPi4B w/ 4GB or 8GB of RAM, is it really necessary to place this limits on Node-RED?

No. And it doesn't do what most people think anyway. All it does is suggest when node.js should commence garbage collection, you cannot really change the amount of memory that node.js actually uses. Generally, current versions of node.js are excellent at managing memory.

In this example, the heap was used up before nr even really got going by the looks of the log so there is some other issue. We need the OP to share the data I asked for.

@Jeff2 also post the contents of /lib/systemd/system/nodered.service please.

Hi,

Thanks and sorry for late feedback, I was travelling for work...

node-red

29 Jul 13:55:28 - [info]

Welcome to Node-RED

29 Jul 13:55:28 - [info] Node-RED version: v3.0.1
29 Jul 13:55:28 - [info] Node.js version: v16.16.0
29 Jul 13:55:28 - [info] Linux 5.15.32-v7l+ arm LE
29 Jul 13:55:29 - [info] Loading palette nodes
29 Jul 13:55:31 - [info] Settings file : /home/jeff/.node-red/settings.js
29 Jul 13:55:31 - [info] Context store : 'default' [module=memory]
29 Jul 13:55:31 - [info] User directory : /home/jeff/.node-red
29 Jul 13:55:31 - [warn] Projects disabled : editorTheme.projects.enabled=false
29 Jul 13:55:31 - [info] Flows file : /home/jeff/.node-red/flows.json
29 Jul 13:55:31 - [info] Creating new flow file
29 Jul 13:55:31 - [warn] Encrypted credentials not found
29 Jul 13:55:31 - [info] Server now running at http://127.0.0.1:1880/
29 Jul 13:55:31 - [info] Starting flows
29 Jul 13:55:31 - [info] Started flows

Here is the answer to node -v command:

v16.16.0

sudo systemctl enable nodered.service doesn't return any error but the service doesn't start

I did this (1st line was there but value was 4096) and it works now !

Many thanks for your quick support !

There will be errors in the syslog if it couldn't start the service at all or in the node-red log if nr tried to start but failed. There are also other systemctl commands to show status and other details which may help.

However, if you are getting the out of memory error before nr really starts, you need to provide the details I asked for.

What type of pi (if it is a pi) are you running on, which OS and how much memory have you got?

What does the command uname -m report ?
What does the command getconf LONG_BIT report ?
What does the command cat /proc/meminfo | grep MemTotal report ?