Skip to content

[QNN EP] fix memory leak in OrtEpFactory::GetSupportedDevices() - #25968

Merged
adrianlizarraga merged 1 commit into
mainfrom
adrianl/qnn-get-ep-devices-memleak
Sep 5, 2025
Merged

[QNN EP] fix memory leak in OrtEpFactory::GetSupportedDevices()#25968
adrianlizarraga merged 1 commit into
mainfrom
adrianl/qnn-get-ep-devices-memleak

Conversation

@adrianlizarraga

Copy link
Copy Markdown
Contributor

Description

Fixes memory leak in OrtEpFactory::GetSupportedDevices(). The OrtKeyValuePairs instance created by the factory was not released.

This memory leak can be reproduced by running the unit test QnnHTPBackendTests.AutoEp_PreferNpu.

Motivation and Context

Fix memory leak that one encounters when using automatic EP selection (e.g., PREFER_NPU) with QNN EP.

Comment thread onnxruntime/core/providers/qnn/qnn_provider_factory.cc

@HectorSVC HectorSVC left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

:shipit:

@adrianlizarraga
adrianlizarraga merged commit 8570298 into main Sep 5, 2025
93 of 94 checks passed
@adrianlizarraga
adrianlizarraga deleted the adrianl/qnn-get-ep-devices-memleak branch September 5, 2025 23:52
snnn pushed a commit that referenced this pull request Sep 8, 2025
### Description
Fixes memory leak in `OrtEpFactory::GetSupportedDevices()`. The
`OrtKeyValuePairs` instance created by the factory was not released.

This memory leak can be reproduced by running the unit test
[QnnHTPBackendTests.AutoEp_PreferNpu](https://github.com/microsoft/onnxruntime/blob/4e2699fbf24d96d2a0261b30509864da08b701de/onnxruntime/test/providers/qnn/qnn_basic_test.cc#L1426).

### Motivation and Context
Fix memory leak that one encounters when using automatic EP selection
(e.g., PREFER_NPU) with QNN EP.

(cherry picked from commit 8570298)
snnn pushed a commit that referenced this pull request Sep 8, 2025
### Description
Fixes memory leak in `OrtEpFactory::GetSupportedDevices()`. The
`OrtKeyValuePairs` instance created by the factory was not released.

This memory leak can be reproduced by running the unit test
[QnnHTPBackendTests.AutoEp_PreferNpu](https://github.com/microsoft/onnxruntime/blob/4e2699fbf24d96d2a0261b30509864da08b701de/onnxruntime/test/providers/qnn/qnn_basic_test.cc#L1426).

### Motivation and Context
Fix memory leak that one encounters when using automatic EP selection
(e.g., PREFER_NPU) with QNN EP.

(cherry picked from commit 8570298)
snnn pushed a commit that referenced this pull request Sep 8, 2025
This PR cherry-picks the following PRs to the rel-1.23.0 branch:

* #25938
* #25957
* #25960
* #25968
* #25971

---------

Co-authored-by: Dmitri Smirnov <yuslepukhin@users.noreply.github.com>
Co-authored-by: Adrian Lizarraga <adlizarraga@microsoft.com>
Co-authored-by: Hariharan Seshadri <shariharan91@gmail.com>
@snnn

snnn commented Sep 8, 2025

Copy link
Copy Markdown
Contributor

This PR has been cherry-picked into the rel-1.23.0 branch in PR #25985. Removing the release:1.23.0 label.

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.

5 participants