filterous-2 icon indicating copy to clipboard operation
filterous-2 copied to clipboard

Memory leak when adding filter to 100 images

Open Name-less opened this issue 7 years ago • 2 comments

Thanks for this library that work very well.

But when I apply a filter on server side with nodejs over 100 images one after another, the memory of the server increase to 300 Mo, and when it's over, the memory is not released and the server still take 300 Mo of memory until we restart it.

It is possible that the issue came from the node-canvas library used, see : https://github.com/Automattic/node-canvas/pull/1003

Are you compatible with node-canvas 2.0-alpha ?

Name-less avatar Oct 19 '17 23:10 Name-less

After some researches, a workaround is possible https://github.com/Automattic/node-canvas/issues/785

add img.src = null; on your importImage function on the onload callback

I will try it out ...

Name-less avatar Oct 19 '17 23:10 Name-less

Finally adding

process.nextTick(function() { img.onload = null; });

Fix the leak, I fork the project here : https://github.com/Name-less/filterous-2/releases/tag/2.0.2

Name-less avatar Oct 20 '17 00:10 Name-less