Skip to content

Commit

Permalink
[TensorRT EP] Fix memory leak for cudnn/cublas (microsoft#18467)
Browse files Browse the repository at this point in the history
Free memory for cudnn/cublas instances at TRT EP destruction.
microsoft#18466
  • Loading branch information
chilo-ms authored and kleiti committed Mar 22, 2024
1 parent 8aa005a commit 9995b87
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1194,6 +1194,11 @@ TensorrtExecutionProvider::~TensorrtExecutionProvider() {
}
}

if (external_stream_) {
ORT_IGNORE_RETURN_VALUE(CUBLAS_CALL(cublasDestroy(external_cublas_handle_)));
ORT_IGNORE_RETURN_VALUE(CUDNN_CALL(cudnnDestroy(external_cudnn_handle_)));
}

if (!external_stream_ && stream_) {
ORT_IGNORE_RETURN_VALUE(CUDA_CALL(cudaStreamDestroy(stream_)));
}
Expand Down

0 comments on commit 9995b87

Please sign in to comment.