title: opencv has triggered a breakpoint Invalid address specified to RtlValidateHeap
body: <p>I wrote some code in C++ and OpenCV 2.49 in Visual Studio 2013:</p>
  
  <pre><code>cv::Mat mask = Mat::zeros(tmp.size(), CV_8UC1);
  </code></pre>
  
  <p>modify mask that some elements are zeros and some elements are 255's</p>
  
  <pre><code>cv::vector&lt;cv::vector&lt;cv::Point&gt; &gt; contours;
  cv::vector&lt;cv::Vec4i&gt; hierarchy;
  cv:findContours(mask, contours, CV_RETR_CCOMP, CV_CHAIN_APPROX_NONE);
  cv::imshow("Mask", mask);
  </code></pre>
  
  <p>When the method ends, following error appears:</p>
  
  <p>Invalid address specified to RtlValidateHeap( 004D0000, 02EBD9D8 )
  Project.exe has triggered a breakpoint.</p>
  
  <p>I searched at stackoverflow and other platforms but can't find an answer!</p>
  
  <p>I added the correct opencv path to the "path" environment variable: C:\opencv\build\x86\vc12\bin
  and also to the project configurations:
  C:\opencv\build\x86\vc12\lib</p>
  
  <p>If I use merge/split from the opencv api it causes the same error, but in this case it is possible to allocate ther vector before going into the method. Then it works. In this case it's not possible to allocate the vector before, because i don't now the size.</p>
  
  <p>I think the problem is that opencv allocates the memory and that's not in the correct heap, but i checked all dll's and paths. Do you have any other ideas?</p>
  
  <p>Thanks in advance!</p>
  
  <p>EDIT:
  I replaced the opencv folder with a new downloaded opencv and it works, don't ask me why!</p>