-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Freeing tensor data created via CreateTensor #19034
Comments
According to C documentation:
Correct me if I am wrong, but this sounds to me like it will NOT be released and user has to take care of it. There could be others function signatures which may take ownership though. Not 100% sure. |
That's correct @laxnpander |
|
we have a std::vector new_arr, and ort::value object buffer is mapped to this new_arr, std::move generally moves the reference out of its scope but when m1 completes , vector goes out of scope and memory buffer will also be deallocated, am i right? |
Describe the issue
I am wondering whether or not we need to manually free the data created via CreateTensor. This API takes in a pointer to our underlying tensor data, but I'm not sure if the pointer is managed by
Ort::Value
itself (and hence will be destructed/deallocated once theOrt::Value
goes out of scope), or if we need to still free the data ourselves.To reproduce
For example, if we have the following:
Ignoring the possibility of a dangling pointer via
new_arr
, do we have to manually freenew_arr
, or willauto_tensor
free the data once it goes out of scope?Urgency
No response
Platform
Mac
OS Version
13.5
ONNX Runtime Installation
Released Package
ONNX Runtime Version or Commit ID
1.16.2
ONNX Runtime API
C++
Architecture
X64
Execution Provider
Default CPU
Execution Provider Library Version
No response
The text was updated successfully, but these errors were encountered: