title: HoughLinesP and opencv memory management
body: <p>I am currently looking at computer vision and try to use Hough-Transform to find some lines. The operation it self is working, however even minimal sample code produces deallocation errors.</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  #include &lt;opencv2/imgproc/imgproc.hpp&gt;
  #include &lt;opencv2/core/core.hpp&gt;
  #include &lt;opencv2/highgui/highgui.hpp&gt;
  
  using namespace std;
  using namespace cv;
  
  int main(int argc, char* argv[])
  {
      int size[] = {100, 100};
      Mat img(1, size, CV_8U);
      img  = cv::Scalar(255);
      vector&lt;Vec4i&gt; lines;
      HoughLinesP(img, lines, 1, CV_PI/180, 100, 30, 5);
  
      cout &lt;&lt; lines.size() &lt;&lt; endl;
  }
  </code></pre>
  
  <p>Note that everything is working if I turn lines into *lines, create the vector on the heap and don't delete it. I cannot see any problem with the code and it is taken straight from the OpenCV example.</p>
  
  <p>The exception occurs in</p>
  
  <pre><code>msvcr110d.dll!_CrtIsValidHeapPointer(const void * pUserData) Line 2036  C++
  </code></pre>
  
  <p>I compile and run this from VS 2012 64bit-Version, and the executable is also 64bit. OS is Windows 7, 64bit</p>