2015-07-14 16:22:17 -0600 | commented question | double free when cv::UMat from cv::Mat with custom UMatData Links to source code. Mat::release() : http://code.opencv.org/projects/openc... UMat::release(): http://code.opencv.org/projects/openc... StdMatAllocator::deallocate(): http://code.opencv.org/projects/openc... |
2015-07-14 16:13:24 -0600 | received badge | ● Editor (source) |
2015-07-14 15:40:56 -0600 | received badge | ● Student (source) |
2015-07-14 15:40:34 -0600 | asked a question | double free when cv::UMat from cv::Mat with custom UMatData It appears that cv::UMatData has two separate reference counts, one for mats, and one for UMats. I've recently run into a problem where I am trying to create a UMat from a Mat in order to get some OpenCL accelerated remapping, but the underlying UMatData is double destroyed. I've recreated a minimal example: Edit 1: fixed no returns I compile this example with where CV_INSTALL_PATH points to where I've installed opencv. When I run this program, the output is: My question is, what is the correct way to avoid this double-destruction given that UMatData has two reference counts, and the data is destroyed when either goes to zero. It does not appear that the default allocator does anything special in this case. Am I supposed to use a custom allocator that checks both reference counts and only destroys data if both are zero? Am I using getUMat in an unintended way? |