Questions about the Stream object destroy

Hello, there is a problem with code reading in CUDAStream +32: LeakyStreamInternals objects need to be destroyed here, and cudaStream_t also needs to be released using cudaStreamDestroy(stream). It seems strange that the code and the comments are there.

Where is cudaStreamDestroy called that causes it to be destroyed repeatedly?

https://github.com/pytorch/pytorch/blob/master/c10/cuda/CUDAStream.cpp +32

Most likely the CUDA runtime was already destroyed at some point, so that the deallocation would raise a segmentation fault and is thus removed.