Skip to content

Avoid release memory from different dll#33993

Open
sgbihu wants to merge 5 commits intoopenvinotoolkit:masterfrom
sgbihu:fix_cross_memory_release
Open

Avoid release memory from different dll#33993
sgbihu wants to merge 5 commits intoopenvinotoolkit:masterfrom
sgbihu:fix_cross_memory_release

Conversation

@sgbihu
Copy link
Contributor

@sgbihu sgbihu commented Feb 6, 2026

Details:

  • Try to fix MEP memory leak, the root cause is openvino.dll released the onnxruntime_providers_openvino.dll's resource. And caused unexpected result.

Tickets:

@sgbihu sgbihu requested a review from a team as a code owner February 6, 2026 05:04
@github-actions github-actions bot added category: Core OpenVINO Core (aka ngraph) category: CPP API OpenVINO CPP API bindings labels Feb 6, 2026
@sgbihu sgbihu requested review from Copilot and removed request for a team February 6, 2026 05:33
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses a memory leak issue (CVS-179009) by converting is_base_type_info from a concrete method to a pure virtual function. This ensures that type checking logic is executed within the same DLL/shared library where the object was created, preventing resource management issues across DLL boundaries.

Changes:

  • Removed the concrete implementation of is_base_type_info from Any::Base
  • Made is_base_type_info a pure virtual function in the base class
  • Added override implementations in RTTIAttribute and Impl derived classes

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/core/src/any.cpp Removed concrete implementation of is_base_type_info method
src/core/include/openvino/core/any.hpp Converted is_base_type_info to pure virtual and added implementations in derived classes

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@sgbihu sgbihu force-pushed the fix_cross_memory_release branch from 740c135 to a5dbe12 Compare February 9, 2026 07:20
@sgbihu sgbihu requested review from Copilot, olpipi and praasz February 9, 2026 07:22
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@sgbihu sgbihu requested review from Copilot and praasz February 10, 2026 06:14
@sgbihu sgbihu changed the title Add virtual function to avoid release resource from another dll Avoid release memory from different dll Feb 10, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

src/core/include/openvino/core/any.hpp:1

  • Changing a pure virtual function’s signature (from returning by value to returning by reference) is an ABI-breaking change for all derived implementations (vtable + override signature changes), which can break external plugins or applications that derive from Any::Base. If ABI stability is required, prefer introducing a new virtual (e.g., base_type_info_ref() returning a reference/view) while keeping the existing base_type_info() by-value API (possibly implemented in Base to copy from the ref-returning function), or otherwise ensure this change is gated behind an ABI/soname bump.
// Copyright (C) 2018-2026 Intel Corporation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@praasz praasz self-assigned this Feb 10, 2026
@praasz praasz added this to the 2026.1 milestone Feb 10, 2026
@sgbihu sgbihu force-pushed the fix_cross_memory_release branch from 14377a2 to 1c815d5 Compare February 11, 2026 01:42
struct TupleToTypeIndex<std::tuple<Args...>> {
static std::vector<std::type_index> get() {
return {typeid(Args)...};
static const std::vector<std::type_index>& get() {
Copy link
Contributor

@olpipi olpipi Feb 11, 2026

Choose a reason for hiding this comment

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

could it lead to dangling reference in the next scenario?
vector is created in onnxruntime_providers_openvino.dll. it is used inside of openvino.dll. onnxruntime_providers_openvino.dll is unloaded. There is a dangling ref inside openvino.dll

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The onnxruntime_providers_openvino.dll depends on openvino.dll, so this is an illegal use case.

@sgbihu
Copy link
Contributor Author

sgbihu commented Feb 12, 2026

build_jenkins

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category: Core OpenVINO Core (aka ngraph) category: CPP API OpenVINO CPP API bindings

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants