Opencv + cuda Memory leakage error, opencvcuda Memory leakage
When using opencv to copy image data in a template, the following error is reported:
Unhandled exception at 0x74dec42d in XXXX_CUDA.exe:
Microsoft C ++ exception: cv: Exception at memory location 0x0017f878.
Locate the error:
CvReleaseImage (& copy_y); that is to say, when the image data is released, illegal memory read/write occurs;
Template <class T> void grad_y (const IplImage * img, IplImage * grad, const IplImage * mask) {IplImage * copy_y = cvCloneImage (img); int h = img-> height; int w = img-> width; int channel = img-> nChannels; cvZero (grad); for (int I = 1; I After reading the literature, many people have encountered similar problems and come to the conclusion that opencv itself is a bug. The strange thing is that I will
IplImage * copy_y = cvCloneImage (img );
Changed:
IplImage * copy_y = NULL; copy_y = cvCloneImage (img );
The problem has been solved. After multiple tests, the bug will not be reproduced and cannot be solved;