Problems in memory management in OpenCV 2.0

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Problems in memory management in OpenCV 2.0

Hi all.
I am developing the face detection in my application, showing video from cameras.

I have copied a code from the example facedetect.cpp

The only difference was a code for producing image structures.
Since my application has already decoded frame in the memory, I simply copy these data to the respective Mat members, possibly with conversion.
I use FFmpeg's libswscale for this purpose.

So far, so goo, however, my application crashes on return from the function detectAndDraw(), if the vector faces is not emtpy.

I tried to make this vector a global variable. Then my application has started crashing on exit at the 'dynamic atexit deallocator of the vector faces'.

It seems to me that my application tries to free a memory which was already freed - this implies buggy destructors somewhere in the OpenCV.

I use MS Visual Studio 2008 SP1 on Windows XP SP3.

Debug window contains
HEAP[PlayerTestContainer.exe]: Invalid Address specified to RtlValidateHeap( 05000000, 0DB60008 )
Windows has triggered a breakpoint in PlayerTestContainer.exe.

This may be due to a corruption of the heap, which indicates a bug in PlayerTestContainer.exe or any of the DLLs it has loaded.

This may also be due to the user pressing F12 while PlayerTestContainer.exe has focus.

facedetect.cpp contains very little code for releasing memory.

Is this sample complete? Or, should I destroy any objects by myself?