dceejay / tfjs-coco-ssd

Node-RED node for tensorflowjs coco ssd
Apache License 2.0
14 stars 10 forks source link

Memory leak #4

Closed simwood-simon closed 4 years ago

simwood-simon commented 4 years ago

This module is awesome but seems to have a memory leak.

If you take the example flow and set the injector to repeat you'll crash node-red with an out-of-memory error pretty quickly. I've played with node-red memory settings and increasing the repeat time (to allow for any clean up or node GC) and that just changes the time to crash linearly as you'd expect.

This is node-red v1.0.5 and node.js v12.16.2 on Linux kernel 4.19.0-8-amd64

dceejay commented 4 years ago

see also this thread - https://discourse.nodered.org/t/object-detection-using-node-red-contrib-tfjs-coco-ssd/22931/116

v0.4.0 rearranges the internals to try to ruse functions rather than redeclare. v0.4.1 adds tf.dispose to help tidy up

simwood-simon commented 4 years ago

Hi Dave.

That looks dramatically better here. No observable leak in the time it'd normally have needing restarting several times. I can see RAM usage going down as well as up.

Nice one, thanks!!