Cuda gpu_mat.cu "out of memory"

Dear all

Hi ! I am new to GPU.I have the following problem.

Environment:
Xeon Silver 4214 2.20GHz
NVIDIA GP104GL QuadroP4000(Driverversion 430.14)
CentOS 7.6.1810
CUDA 10.1
OpenCV3.4.6

Program:
Resize the image.

Source Overview:
int main(int argc,char* argv)
{
UMat u_img;

Mat	srcCPU	= imread(FLAGS_src);
cuda::GpuMat	srcGPU;
cuda::GpuMat	dstGPU;
Mat	dstCPU;

srcGPU.upload(srcCPU);

double	ratio = (double)FLAGS_w/srcCPU.cols;

cuda::resize(srcGPU,dstGPU,Size(),ratio,ratio,INTER_AREA);
dstGPU.download(dstCPU);

imwrite(FLAGS_dst,dstCPU);

srcGPU.release();
dstGPU.release();

}

Problem:
If program resize the image about 200 times, the following error occurs.

“terminate called after throwing an instance of ‘cv::Exception’
what(): OpenCV(3.4.6) /OpenCV/opencv-3.4.6/modules/core/src/cuda/gpu_mat.cu:116: error: (-217:Gpu API call) out of memory in function ‘allocate’”

It does not occur when resizing on the CPU.
It does not occur when resizing by GTX1050.
The program run continuously, but not at the same time.

Can anyone help me?

Best Regards