I have a program which would use cudaMallocHost()
to allocate the pinned memory, but I forget to use cudaFreeHost()
to free the pinned memory...
I run this program once and then exit, but next time I want to run the same program, it would throw segmentation fault when I called cudaMallocHost
.
I suspected that is due to the memory is pinned when I first run the program, and when I try to run the program one more time, the OS couldn't find any more memory that could be pinned...
My question is, is there any CUDA API that I can call to clear the already pinned memory in host without knowing the host memory address? I lookup the CUDA document but didn't find any, and rebooting didn't help either.
Edit
I run htop
and found that there is a 17GB of memory which seems like nobody is using it.
I wonder if this is the memory that I pinned?