Hi all, I've found a fairly bad memory leak updating to nodejs 8.9.0, which I think should be of concern generally in NR.
Environment: Nodejs 8.9.0 NR 0.17.5 Note: this did not occur in nodejs 6.11 In a function node, I have the following code: //////////////////////////////// var starttime = new Date(); var AfterResize = function(err, img){ var resizetime = (new Date()) - starttime; node.send([null, {payload:resizetime, topic:"resizetime"}]); msg.img = img; node.send([msg, null]); }; var Async = false; if (Async){ // note - generates a new image msg.camera.resize(flow.get('width'), flow.get('height'), AfterResize); } else { node.send(msg); } return; //////////////////////////////////////// msg.camera is a large object. But in the above code, we're not actually doing anything.... We get a new date, and send the msg on. (*and the wire is not connected anywhere....*). What seems to happen is that nodejs 8.9.0 stores away a reference to msg so that it COULD be used when the function is called, and never releases it (at least for the 20s my pi lasts before it blows at 800mbytes memory use). The problem also occurs if Async is set to true; but I didn't want to complicate matters with questions like 'what does resize do'!. If the msg is NOT sent on (i.e. comment our node.send(msg) ) - the memory does not leak. If "return msg;" is used instead, it does still leak. If I remove the reference to msg from the function, it does not leak. *I believe this is a fairly big problem for node-red; I only found it because of the size of the video frames in my messages, but anyone using something like the above (using msg in a local function) will suffer memory leaks...* thoughts? s -- Job board: http://jobs.nodejs.org/ New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscr...@googlegroups.com. To post to this group, send email to nodejs@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/4f930ef0-1c0b-49f0-a074-e92dd87b3871%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.