I am using the java wrapper of OpenCV. I tried to write an Iterator over frames of a film. My problem is that the iterator is a huge memory leak. Here is a very simplified v
I just want to add my $0.02 as I bumped into this issue when writing an application that will run for a long.
Mat.release() is called automatically when the Java Mat-wrapper is garbage collected. However, since the Java wrapper is very small compared to the natively allocated object, it might not be garbage-collected fast enough.
Therefore, you could either do Mat.release()
when you know you are done with an object or call System.gc()
at regular intervals to force removal of unused objects.