Strange crashes during deallocation of std::vector (VS2015, Windows 7)
Hey all,
I'm running OpenCV 2.4.11 on Windows 7, compiling with Visual Studio 2015.
I've found that during several function calls (to Stitcher::Stich
and cv::findContours
, for example), there is a critical memory error that causes the program to crash consistently.
For these errors, I get an error like the following in visual studio:
Debug Assertion Failed!
Program: ...a\code\my-project\software\Debug\my-project.exe
File: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\xmemory0
Line: 116
Expression: "reinterpret_cast<uintptr_t *>(_Ptr_ptr)[-1] == _BIG_ALLOCATION_SENTINEL" && 0
When I follow the call stack to find out where the crash happened, it always happens at the end of a function when local variables go out of scope. The error is usually on the line:
my-project.exe!std::_Deallocate<cv::Point_<int> >(cv::Point_<int> * _Ptr, unsigned __int64 _Count) Line 114 C++
or similar (I believe when I call Sticher::stitch
the crash is for a vector of type cv::DMatch
rather than cv::Point
).
If I comment out the specific lines (such as cv::findContours
), the program runs just fine. In fact, the program works just fine until cv::findContours
actually finds a contour; in this case it immediately crashes with the above memory errors.
I've checked that I have the right .dll
files, and I do -- I'm wondering if perhaps I need to rebuild OpenCV for Visual Studio 2015? I'm not sure what else would be causing this problem.
thanks!
please double check, if you''re accidentally using any opencv release libs with a debug build, or the other way round
Just double-checked -- I even removed all of the release .dlls and compiled / ran in Debug to make sure that wasn't the issue, but my program still crashed with the same error.
I suggest rebuilding, since findContours is working perfectly fine here :)
Did you need to rebuild it from source? Are you using VS2015? I've never rebuilt OpenCV from source before, so I'm a bit reluctant to try it -- but I'd also love to have this problem solved :) Hoping the rebuild process goes smoothly!
I am using Ubuntu and Linux... but I see a lot of people with problems that get solved once they build OpenCV themselves.
I get the same error when using findContours. Did rebuilding solve the problem for you?