Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TensorRT EP] Fix memory leak for cudnn/cublas #18467

Merged
merged 1 commit into from
Nov 16, 2023
Merged

Conversation

chilo-ms
Copy link
Contributor

Free memory for cudnn/cublas instances at TRT EP destruction.
#18466

@jywu-msft jywu-msft merged commit 3588fba into main Nov 16, 2023
88 of 91 checks passed
@jywu-msft jywu-msft deleted the chi/mem_leak_fix branch November 16, 2023 18:23
jywu-msft pushed a commit that referenced this pull request Nov 17, 2023
Free memory for cudnn/cublas instances at TRT EP destruction.
#18466
@@ -1194,6 +1194,11 @@ TensorrtExecutionProvider::~TensorrtExecutionProvider() {
}
}

if (external_stream_) {
ORT_IGNORE_RETURN_VALUE(CUBLAS_CALL(cublasDestroy(external_cublas_handle_)));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we store these in class member unique_ptrs (with custom deleter) at the time of creation so that we don't have to remember to destroy them? It looks like this code is repeated in both ~PerThreadContext and ~TensorrtExecutionProvider.
The same applies to this part of the code.

hgaiser pushed a commit to robohouse-delft/onnxruntime that referenced this pull request Nov 23, 2023
kleiti pushed a commit to kleiti/onnxruntime that referenced this pull request Mar 22, 2024
Free memory for cudnn/cublas instances at TRT EP destruction.
microsoft#18466
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants