The installation notes for Raspberry pi explain the need to start node-red with the specific Pi command and pass the parameter that tells Node.js to free up space earlier than it would normally do.
node-red-pi --max-old-space-size=256
But it does not explain whether you need, or how, to do the same thing if you set it up as a service to start at boot.
Could somebody clarify if it is wise/necessary to use the special Pi command in that case, and if so - how.
When you run as a service it uses the nodered.service file we configure to start up... this is usually at /lib/systemd/system/nodered.service - so you can look at that to see how we have defaulted it to your device. (and indeed edit it if you want)
The option helps Node.js steer when it does garbage collection of allocated space that is no longer needed. Because GC is an overhead, it isn't done unless really needed.
So the option wouldn't have any impact unless you happen to hit a situation where you are filling up and emptying the stack quite rapidly coupled with constrained memory.
It was recommended at one stage by Nick & Dave because we were seeing quite a few cases of out-of-memory issues and constraining the GC process seemed to help. Since then, perhaps node.js and the underlying V8 engine have gotten more efficient. Perhaps the CG process is also now more efficient. Maybe Node-RED is also more efficient.
But you are right. For most people, most of the time, they will not get much, if any benefit from that option.
The config is in /lib/systemd/system on mi Pi and the setting is
Environment="NODE_OPTIONS=--max_old_space_size=512"
I'm going to leave well alone for now as nobody seems to have had a problem (and neither have I!) with that setting, but at least I now know where to look!