bennetthardwick / darknet.js

A NodeJS wrapper of pjreddie's darknet / yolo.
65 stars 27 forks source link

Memory Leak #28

Closed ls159753 closed 4 years ago

ls159753 commented 5 years ago

Hi, First of all, thanks a lot for the great work and continued support for this wrapper. It works very well from what I used it for albeit it is slower than the original. However, I have been using it on long videos and rtsp streams and noticed that the ram usage keeps going up and up until the computer just crashes from having all its memory hogged up.

Is this only happening to me or is this known?

bennetthardwick commented 5 years ago

Just to confirm, are you using the opencv method shown in the README? If you are, it looks like there's a bug where I forgot to free the loaded image: https://github.com/bennetthardwick/darknet.js/blob/65178997c43a1cbee59365570ddce4d68fdcde2d/cppsrc/detector.cpp#L119

I've just released darknet@2.0.16 or darknet@beta that fixes this bug, it looks fine from my testing but could you give it a go and let me know whether it fixes your issue?

ls159753 commented 5 years ago

Thanks for the quick reply. I tried darknet@2.0.16 and encountered a Segmentation fault (core dumped) after the first frame has been successfully processed. I reverted back to darknet@2.0.15 which works well with the memory leak. I then manually added free_image(i) in detector.cpp and recompiled to the same Segmentation fault (core dumped). (just to isolate the problem) I am using the opencv method along with CUDA and CUDNN. Is this something you are able to reproduce on your end?

bennetthardwick commented 5 years ago

I'm away from my computer at the moment and haven't been able to test with OpenCV. I'll be able to test mid next week.