for-aiur / yolo_cpp

C++ed version of Yolo
Other
69 stars 37 forks source link

Memory leakage #3

Open fdesmedt opened 7 years ago

fdesmedt commented 7 years ago

Hi,

I like your cpp wrapper of the Yolo detector, and I want to use it for object detection integration in several of my projects.

When I am processing large video-files, I see my memory slowly running full however. When I digged into the code, I saw at a lot of places the use of malloc/calloc calls are at the base of this problem (possibly inherited from the C code base?). Why not replace those with shared pointers to ensure correct memory behaviour?

ouceduxzk commented 6 years ago

@fdesmedt I also observed such problems, darknet with webcam increases memory usage and eventually crash, do you have some fix ?

IngvarRagnarsson commented 6 years ago

Found the issue. At the yolo.cpp file, add this line right before delete[] probs in the try{} block for(int i = 0; i<output_size;i++) delete probs[i];

Then, the floats allocated to the probability array will get deleted as well.