Hi,
I want to run a js function forever, but it seems that nodered crashes after some loop if I add a "while" in the node.
var increment = 0;
function Looper() {
increment = increment +1;
console.log("i'm running"+increment);
return increment
}
while(true)
{
msg = { payload: Looper() }
node.send(msg);
}
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
get those row in console outpus then it stop and need to restart nodered:
feb 17 15:55:24 Node-RED[1484]: i'm running2546
feb 17 15:55:24 Node-RED[1484]: i'm running2547
feb 17 15:55:24 Node-RED[1484]: i'm running2548
feb 17 15:55:24 Node-RED[1484]: i'm running2549
feb 17 15:55:24 Node-RED[1484]: i'm running2550
feb 17 15:55:24 Node-RED[1484]: i'm running2551
feb 17 15:55:24 Node-RED[1484]: i'm running2552
feb 17 15:55:24 Node-RED[1484]: i'm running2553
feb 17 15:55:24 Node-RED[1484]: i'm running2554
feb 17 15:55:24 Node-RED[1484]: i'm running2555
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
Am I doing a wrong approach?
Thank you, BR