git memory leak with VideoCapture (python)

asked 2013-12-30 08:52:45 -0500

edward.81 gravatar image

updated 2013-12-30 08:54:20 -0500

I just compiled the last git code (December 27 2013) with codeblocks and minGW 4.8.1 on win7x64 and python 2.7.3 (32) Unlucky a simple python code return a memory error while processing a video file

import numpy as np
import cv2
im = cv2.VideoCapture("myvideofile.avi")
    ret, frame =
    if cv2.waitKey(1) & 0xFF == ord('q'):

Output after some frame (depend on video size)

OpenCV Error: Unspecified error (The numpy array of typenum=2, ndims=3 can not be created) in allocate, file C:\opencv_git\modules\python\src2\cv2.cpp, line 223
OpenCV Error: Insufficient memory (Failed to allocate 2764800 bytes) in OutOfMemoryError, file C:\opencv_git\modules\core\src\alloc.cpp, line 52
Traceback (most recent call last):
File "c:\folder\", line 12, in <module>
    ret, frame =
cv2.error: C:\opencv_git\modules\core\src\alloc.cpp:52: error: (-4) Failed to allocate 2764800 bytes in function OutOfMemoryError

I was wondering if I had did something wrong in the compilation or is it a bug. I can not find anything on the tracker

edit retag flag offensive close merge delete


also happens when I open an image

import cv2
    frame = cv2.imread("c:\\lol.jpg")

With the 2.4.1 stable this code is ok with the 3.0-dev the process memory increase until crashes

edward.81 gravatar imageedward.81 ( 2013-12-31 10:43:42 -0500 )edit