Clustering Memory Leak (not solved)

Posted: September 26, 2013 at 3:01 pm

Further testing has shown that there is still a leak in the clustering code, but I can’t figure out where it is. It does seem that cv::Mat is somehow at the centre of this issue though. I had previously noticed that I could stop the memory increase just by commenting out the mergeImages() code (that averages images for two percepts). This week I realized that I can also stop the memory increase if I don’t normalize the feature vector before clustering. Now this really does not make sense since I rewrote all the feature-related code to change from a vector of floats to a cv::Mat so I could use the opencv normalization functions. There is no code overlap between the previous version of normalize and this new version, and yet if I run normalization and clustering memory increases (red line), if I run either independently (blue and green) there is no memory increase:


I can’t recall why I thought this memory increase was solved before. I may have not been running the normalization code in that test, i.e. I was testing clustering with only foreground objects, where normalization is not needed due to perceptual distances in CIELuv.