Can you clarify what you are hoping to see when releasing im_source and creating im_search?
I have just checked and it appears that the memory allocated by cv::cuda::setBufferPoolConfig is not released when it goes out of scope. This may be by design.
That said I am not sure what you are hoping to see when releasing im_source and creating im_search. I would expect the total free memory on the device to remain constant because it was allocated in the call to cv::cuda::setBufferPoolConfig and creating and destroying GpuMat’s simply uses some of that pre-allocated memory.
outMat is all zero when use default allocator. this is different from bufferpool
I hope the bufferpool and the default allocator should be the same.
Buf I don’t know if bufferpool designed like this
#include <iostream>
#include <opencv2/imgproc.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/core/cuda.hpp>
using namespace std;
using namespace cv;
using namespace cv::cuda;
int main()
{
cv::cuda::setBufferPoolUsage(true);
cv::cuda::setBufferPoolConfig(cv::cuda::getDevice(), 1024 * 1024 * 64, 1);
cv::cuda::Stream stream;
cv::cuda::BufferPool pool(stream);
Mat mat_source = imread("test.png", cv::IMREAD_COLOR); //Any picture is OK
GpuMat im_source = GpuMat(mat_source.size(), CV_8UC3);
im_source.upload(mat_source);
im_source.release();
GpuMat im_search = GpuMat(10, 10, CV_8UC1);
Mat outMat;
im_search.download(outMat);
cout << outMat << endl;
return 0;
}
What value would you expect outMatto be? With BufferPool outMat is zero for me are you expecting it to contain some of the values left over from im_source?