title: Failed to allocate huge images in OpenCV
body: <p>I'm working since a year on image processing with OpenCV 2.2.0. </p>
  
  <p>I get a memory allocation error ONLY if I try to allocate a >2GB IplImage, given that the same allocation with CvMat works. I can allocate whatever I want using CvMat, I tried also >10 GB.</p>
  
  <p>OpenCV was 64-bit compiled and also this simple application. Furthermore, I'm sure that the application runs in 64-bit mode as I can see from the Task Manager. The O.S. (Windows 7) is 64-bit too.</p>
  
  <pre><code>int main(int argc, char* argv[])
  {
      printf("trying to allocate &gt;2GB matrix...\n");
      CvMat *huge_matrix = cvCreateMat(40000,30000,CV_16UC1);
      cvSet(huge_matrix,cvScalar(5));
      printf("...done!\n\n");
      system("PAUSE");
  
      printf("trying to allocate &gt;2GB image...\n");
      IplImage *huge_img = cvCreateImage(cvSize(40000,30000),IPL_DEPTH_16U, 1);
      cvSet(huge_img,cvScalar(5));
      printf("...done!\n\n");
      system("PAUSE");
  
      cvReleaseMat(&amp;huge_matrix);
      cvReleaseImage(&amp;huge_img);
  }
  </code></pre>
  
  <p>The error message is "Insufficient memory:  in unknown function... can it be a bug?</p>