Opencv:VideoCapture内存泄漏

时间:2016-09-01 18:48:01

标签: c++ opencv memory-leaks valgrind

我不明白为什么我的valgrind检测错误,因为程序实际上只是调用构造函数并删除指针。

    class VideoFile
    {
    private:
        cv::VideoCapture * cap;
        unsigned int index;
    public:
        bool isValid() { return cap->isOpened(); }

        VideoFile(const std::string & path)
            :cap(new cv::VideoCapture(path))
        {
            current_index = 0;
        }

        ~VideoFile() 
        {
            delete cap;
        }
     };

这是报告表单valgrind: https://gist.github.com/anonymous/97d2b965d6fec43d27ac8fecb0a2026a

我正在使用opencv版本2.4.9.1

这是我的主要内容:

int main()
{
    std::string FilePath;
    std::cout << "Please enter the path to the video file:";
    std::cin >> FilePath;
    std::cout << std::endl;
    VideoFile videofile(FilePath);
    return 0;
}

0 个答案:

没有答案