Describe the issue
In include/onnxruntime/onnxruntime_cxx_inline.h, in GetOverridableInitializerNames()'s for-loop, the memory allocated for names isn't freed after use:
for (size_t i = 0; i < num_initializers; ++i) {
char* name;
ThrowOnError(GetApi().SessionGetOverridableInitializerName(this->p_, i, allocator, &name)); // memory allocated
initializer_names.emplace_back(name); // name copied
// missing allocator.Free(name);
}
return initializer_names;
To reproduce
Track memory and run session.GetOverridableInitializerNames() multiple times with a model with at least one overridable initializer name (ex. onnxruntime\test\testdata\unused_initializer.onnx):
for (size_t i = 0; i < number_of_runs; ++i)
{
auto temp_names = session.GetOverridableInitializerNames();
}
Before adding the missing line, the allocated memory size increases after each run.
After adding the missing line, the allocated memory size stays the same.
Urgency
No response
Platform
Other / Unknown
OS Version
Custom
ONNX Runtime Installation
Built from Source
ONNX Runtime Version or Commit ID
on the main branch
ONNX Runtime API
C++
Architecture
Other / Unknown
Execution Provider
Other / Unknown
Execution Provider Library Version
No response
Describe the issue
In
include/onnxruntime/onnxruntime_cxx_inline.h, inGetOverridableInitializerNames()'s for-loop, the memory allocated for names isn't freed after use:To reproduce
Track memory and run
session.GetOverridableInitializerNames()multiple times with a model with at least one overridable initializer name (ex.onnxruntime\test\testdata\unused_initializer.onnx):Before adding the missing line, the allocated memory size increases after each run.
After adding the missing line, the allocated memory size stays the same.
Urgency
No response
Platform
Other / Unknown
OS Version
Custom
ONNX Runtime Installation
Built from Source
ONNX Runtime Version or Commit ID
on the main branch
ONNX Runtime API
C++
Architecture
Other / Unknown
Execution Provider
Other / Unknown
Execution Provider Library Version
No response