Here is my test code. I use memory profile of visual studio performance profiler for take snapshot of heap.
The results suggest that there is a leak.
My graphic card and driver version is NVIDIA RTX 3080 Ti
and 537.13
and Here is CUDA Toolkit version information.
{
"cuda" : {
"name" : "CUDA SDK",
"version" : "12.1.1"
},
"cuda_cccl" : {
"name" : "CUDA C++ Core Compute Libraries",
"version" : "12.1.109"
},
"cuda_cudart" : {
"name" : "CUDA Runtime (cudart)",
"version" : "12.1.105"
},
"cuda_cuobjdump" : {
"name" : "cuobjdump",
"version" : "12.1.111"
},
"cuda_cupti" : {
"name" : "CUPTI",
"version" : "12.1.105"
},
"cuda_cuxxfilt" : {
"name" : "CUDA cu++ filt",
"version" : "12.1.105"
},
"cuda_demo_suite" : {
"name" : "CUDA Demo Suite",
"version" : "12.1.105"
},
"cuda_nvcc" : {
"name" : "CUDA NVCC",
"version" : "12.1.105"
},
"cuda_nvdisasm" : {
"name" : "CUDA nvdisasm",
"version" : "12.1.105"
},
"cuda_nvml_dev" : {
"name" : "CUDA NVML Headers",
"version" : "12.1.105"
},
"cuda_nvprof" : {
"name" : "CUDA nvprof",
"version" : "12.1.105"
},
"cuda_nvprune" : {
"name" : "CUDA nvprune",
"version" : "12.1.105"
},
"cuda_nvrtc" : {
"name" : "CUDA NVRTC",
"version" : "12.1.105"
},
"cuda_nvtx" : {
"name" : "CUDA NVTX",
"version" : "12.1.105"
},
"cuda_nvvp" : {
"name" : "CUDA NVVP",
"version" : "12.1.105"
},
"cuda_opencl" : {
"name" : "CUDA OpenCL",
"version" : "12.1.105"
},
"cuda_sanitizer_api" : {
"name" : "CUDA Compute Sanitizer API",
"version" : "12.1.105"
},
"libcublas" : {
"name" : "CUDA cuBLAS",
"version" : "12.1.3.1"
},
"libcufft" : {
"name" : "CUDA cuFFT",
"version" : "11.0.2.54"
},
"libcurand" : {
"name" : "CUDA cuRAND",
"version" : "10.3.2.106"
},
"libcusolver" : {
"name" : "CUDA cuSOLVER",
"version" : "11.4.5.107"
},
"libcusparse" : {
"name" : "CUDA cuSPARSE",
"version" : "12.1.0.106"
},
"libnpp" : {
"name" : "CUDA NPP",
"version" : "12.1.0.40"
},
"libnvjitlink" : {
"name" : "JIT Linker Library",
"version" : "12.1.105"
},
"libnvjpeg" : {
"name" : "CUDA nvJPEG",
"version" : "12.2.0.2"
},
"libnvvm_samples" : {
"name" : "NVVM Samples",
"version" : "12.1.105"
},
"nsight_compute" : {
"name" : "Nsight Compute",
"version" : "2023.1.1.4"
},
"nsight_vse" : {
"name" : "Nsight Visual Studio Edition (VSE)",
"version" : "2023.1.1.23089"
},
"nvidia_driver" : {
"name" : "NVIDIA Windows Driver",
"version" : "531.14"
}
}