There is still memory occupied after the tensor is released

Hi, guys!
I created a new tensor to observe the occupation of video memory. When I load it on the GPU, I can see a significant increase in video memory (by nvidia-smi). However, when I load it to the CPU and release it (I used torch.cuda.empty.cache(), I know that if this is not used, the video memory occupation may not be refreshed), but the video memory occupation does not return to 0, and It is 377M left (sometimes 367M). I don’t quite understand why is there still memory consumption? Why is it 377M? Is this the memory that PyTorch must occupy when calling CUDA?
Is there any way to release this memory?

Here is my environment:

  • PyTorch version:1.2.0

  • CUDA version: release 10.1, V10.1.243

PS:I didn’t initialize any network parameters :smiley:

The memory should be used by the CUDA context, which is initialized with the first CUDA operation, e.g. creating a tensor.
You cannot release it during the runtime of your script.

1 Like

Thank you for your reply!Have a good day! :smile: