# Revision history [back]

### Memory leak in Mat::convertTo

While using warpPerspective with openCL I was having a memory leak. Disabling opencl by using Mat or calling cv::ocl::setUseOpenCL(false) solved the problem. I think I've tracked it down to a line in ocl_warpTransform that uses convertTo from Mat to UMat. Here is code to replicate this. Bug?

    Mat matM(Size(5, 5), CV_32F);
UMat M0;
matM.convertTo(M0, CV_32F);


### Memory leak in Mat::convertTo

While using warpPerspective with openCL I was having a memory leak. Disabling opencl by using Mat or calling cv::ocl::setUseOpenCL(false) solved the problem. I think I've tracked it down to a line in ocl_warpTransform that uses convertTo from Mat to UMat. Here is code to replicate this. Bug?this.

int main(int, char)
{
while (true)
{
Mat matM(Size(5, 5), CV_32F);
CV_32F),temp;
UMat M0;
matM.convertTo(M0, CV_32F);
}
}


I used VS 2015 diagnostics tool (alt-F2). Ran this program and did a memory snapshot at about 2 sec and another one 10 seconds later. Attached is a picture of the changed memory report.

### Memory leak in Mat::convertTo

While using warpPerspective with openCL I was having a memory leak. Disabling opencl by using Mat or calling cv::ocl::setUseOpenCL(false) solved the problem. I think I've tracked it down to a line in ocl_warpTransform that uses convertTo from Mat to UMat. Here is code to replicate this.

int main(int, char)
{
while (true)
{
Mat matM(Size(5, 5), CV_32F),temp;
UMat M0;
matM.convertTo(M0, CV_32F);
}
}


I used VS 2015 diagnostics tool (alt-F2). Ran this program and did a memory snapshot at about 2 sec and another one 10 seconds later. Attached is a picture of the changed memory report.

### Memory leak in Mat::convertTo

While using warpPerspective with openCL I was having a memory leak. Disabling opencl by using Mat or calling cv::ocl::setUseOpenCL(false) solved the problem. I think I've tracked it down to a line in ocl_warpTransform that uses convertTo from Mat to UMat. Here is code to replicate this.

int main(int, char)
{
while (true)
{
Mat matM(Size(5, 5), CV_32F),temp;
CV_32F);
UMat M0;
matM.convertTo(M0, CV_32F);
}
}


I used VS 2015 diagnostics tool (alt-F2). Ran this program and did a memory snapshot at about 2 sec and another one 10 seconds later. Attached is a picture of the changed memory report.