0

I have an openCV application that tracks 3 different colours and draws lines between where it is tracking. I have to keep this application running for a few hours but after about 40 minutes it tells me my mac osx start up disk has no more space available for application memory. Is there a way to flush the memory so that I can keep this running?

IplImage* imgYellowThresh1 = GetThresholdedImage1(frame,1);

double moment10 = cvGetSpatialMoment(moments_yellow, 1, 0);
double moment01 = cvGetSpatialMoment(moments_yellow, 0, 1);
double area = cvGetCentralMoment(moments_yellow, 0, 0);

so I do this for 2 other colours, add then to the frame

cvReleaseImage(&imgYellowThresh1);
delete moments_yellow;
Bull
  • 11,771
  • 9
  • 42
  • 53
user2645586
  • 71
  • 13
  • 3
    You must have a memory leak in your code. There is no problem in running the application for a long time unless you allocate memory all the time (`cvCreateImage`) that you don't free later (`cvReleaseImage`). – ChronoTrigger Sep 11 '13 at 13:10
  • 3
    You are very likely to have memory leak because of inaccurate manual memory management. Unless you already have too much code written in this style, I would recommend rewriting it using `cv::Mat` instead `IplImage`, since latter is [considered deprecated](http://stackoverflow.com/questions/5192578/opencv-iplimage). `cv::Mat`, on other hand, is a new-style image representation that has excellent RAII-based memory management. This should reduce number of possible memory-related issues dramatically (though not all of them, so you still have to track memory allocation in your application). – ffriend Sep 11 '13 at 13:45
  • What is `GetThresholdedImage1()`? Can you post some more code? Use the new API and you will have much less trouble. – Bull Sep 11 '13 at 13:45
  • Sorry think it was fixed with a simple image release. Does Iplimage translate to cv::Mat quite easily? thanks. – user2645586 Sep 11 '13 at 16:16

0 Answers0