Skip to content

Conversation

@pranavsharma
Copy link
Contributor

OrtEnv gets created twice in onnx_loader. This causes its refcount to
increase to 2. Due to this when ReleaseEnv is called inside ~OnnxLoader,
it does nothing other than decrease the refcount to 1. Next when all the libraries
are unloaded the openvino global context ptr gets unloaded first followed by OrtEnv's
destructor which now actually does useful work trying to delete the openvno ctx ptr
which is not valid any more causing memory corruption.

OrtEnv gets created twice in onnx_loader. This causes its refcount to
increase to 2. Due to this when ReleaseEnv is called inside ~OnnxLoader,
it does nothing other than decrease the refcount to 1. Next all the libraries
are unloaded the openvino global context ptr gets unloaded followed by OrtEnv's
destructor which now actually does useful work trying to delete the openvno ctx ptr
which is not valid any more causing memory corruption.
@GuanLuo GuanLuo merged commit c8041cf into main May 7, 2022
@Tabrizian Tabrizian deleted the FixEnvCreation branch May 24, 2022 15:02
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