[CXX API] Fix memory leak for KernelContext_GetAllocator by adrianlizarraga · Pull Request #26883 · microsoft/onnxruntime
alex-spacemit pushed a commit to spacemit-com/onnxruntime that referenced this pull request
Jan 20, 2026…6883) ### Description - Updates the C++ API function `Ort::KernelContext::GetAllocator` to return a `Ort::Allocator`, which releases the allocator instance on destruction. - Fixes a memory leak in a unit test by using the fixed `Ort::KernelContext::GetAllocator` API. ### Motivation and Context Users of the C++ API should not have to manually call `ReleaseAllocator` on the result of `Ort::KernelContext::GetAllocator`. This expectation will make leaking memory common. Refer to original PR that added the API: microsoft#15591
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters