RuntimeError: CUDNN_STATUS_INTERNAL_ERROR when l run the program for a second time

How did you know it didn’t free the memory? Only using nvidia-smi? Or is there something else? Because cheking with nvidia-smi the memory seems to be free after the script terminates.