Intel® Distribution of OpenVINO™ Toolkit
Community assistance about the Intel® Distribution of OpenVINO™ toolkit, OpenCV, and all aspects of computer vision-related on Intel® platforms.

OpenVINO seems to leak memory

North-man
New Contributor I
4,070 Views

This always happens when using ov::Core in the C++ execution environment.

I checked with OpenVINO2023.0.0 C++ sample (classification_sample_async) using the _Crt Mem method.

And it was the same with the previous version (2021.4.752 or 2022.3.0).


I attached the code for memory leak confirmation that added _CrtMem to the classification_sample_async sample (main.cpp)


Running this detected the leak as below:

Dumping objects ->
{253771} normal block at 0x000001BAE43B8700, 112 bytes long.
Data: <@ ; 0 ; > 40 8F 3B E4 BA 01 00 00 30 98 3B E4 BA 01 00 00
{253770} normal block at 0x000001BAE43B9830, 112 bytes long.
Data: < ; @ ; > 00 87 3B E4 BA 01 00 00 40 8F 3B E4 BA 01 00 00
{253769} normal block at 0x000001BAE31B4590, 128 bytes long.
Data: <@ ; @ ; > 40 8F 3B E4 BA 01 00 00 40 8F 3B E4 BA 01 00 00
{253768} normal block at 0x000001BAE3218760, 16 bytes long.
Data: < v > 00 76 80 08 F8 7F 00 00 00 00 00 00 00 00 00 00
{253767} normal block at 0x000001BAE43B8F40, 112 bytes long.
Data: <0 ; ; > 30 98 3B E4 BA 01 00 00 00 87 3B E4 BA 01 00 00
{253766} normal block at 0x000001BAE32173B0, 16 bytes long.
Data: < u > E8 75 80 08 F8 7F 00 00 00 00 00 00 00 00 00 00

 :

Object dump complete.

 

Any plans to fix this?

Thank you!

 

 

 

0 Kudos
12 Replies
Aznie_Intel
Moderator
4,018 Views

Hi North-man,

 

Thanks for highlighting this. We are going to investigate this and get back to you.

Could you share what hardware you are using? (CPU model, OS,etc)

 

 

Regards,

Aznie


0 Kudos
North-man
New Contributor I
4,010 Views

Hi Aznie,

Thank you for your response.

 

My environment is below.

  • Windows10
  • Intel(R) Xeon(R) W-2145 CPU @ 3.70GHz
  • C++
  • OpenVINO2023.0.0, 2022.3.0.0, 2021.4.752

 

Please let me know if any information is missing.

 

Regards,

North-man

 

 

0 Kudos
Aznie_Intel
Moderator
3,960 Views

Hi North-man,

 

We have validated your main.cpp and we are unable to observe any significant memory leak compared to the default main.cpp.

customer_main (4).jpg

 

Could you share how you test the memory leak so that we can duplicate it on our end?

 

 

Regards,

Aznie

 

0 Kudos
North-man
New Contributor I
3,950 Views

Hi Aznie,

Thank you for your response.

 

Sorry, I didn't explain enough.

 

I'm running in Debug mode in VisualStudio 2019.

If there is a memory release leak in the heap area immediately after executing the _CrtMemDumpAllObjectsSince method, it will dump the information.

https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/crtmemdumpallobjectssince?view=msvc-170

 

Northman_1-1688012731933.png

 

Please let me know if any information is missing.

 

Regards,

North-man

0 Kudos
Aznie_Intel
Moderator
3,919 Views

 

Hi North-man,

 

Could you please elaborate on how you running the classification_sample_async and which model you are using? By default, the classification will require for model and input path.

debugger_issue.JPG

 

 

Regards,

Aznie

 

0 Kudos
North-man
New Contributor I
3,911 Views

Hi Aznie,

Thank you for your response.


>>By default, the classification will require for model and input path

Yes,  I have set the model and inputs for debugging in the classification_sample_async project properties.

Since the inference result is not so relevant, the model and the inputs can be anything.

 

Northman_0-1688112053490.png


I have a simple model and image that I used for validation.

I can't upload it to this site, so if you tell me your email address, I can provide it.

 

Regards,

North-man

0 Kudos
Aznie_Intel
Moderator
3,882 Views

 

Hi North-man,

 

You can share it to my email:noor.aznie.syaarriehaahx.binti.baharuddin@intel.com

 

 

Regards,

Aznie

 


0 Kudos
Aznie_Intel
Moderator
3,837 Views

Hi North-man,

 

Thanks for your patience while we are validating this memory leak. I can confirm there is a memory leak in the Image Classification Async C++ Sample on Windows CPU with OpenVINO 2023 release.

 

confirm memoryleak.jpeg

 

I will escalate this to our development team for rectification which might take some time. I will provide you with the latest updates once available from their end.

 

 

Regards,

Aznie

 

0 Kudos
North-man
New Contributor I
3,739 Views

Hi Aznie,

Thank you for your response.

I've got it.
I look forward to your update.

 

Regards,

North-man

 

0 Kudos
Peh_Intel
Moderator
3,634 Views

Hi North-man,

 

We have received updates from our development team as follows.

 

`CrtDumpMemoryLeaks()` reports all objects that weren't destroyed (global objects too). So, they were able to reproduce the issue with `include "openvino/openvino.hpp"` only (without any execution in main), or with `DEFINE...` macro from `gflags` library (used by sample) without OpenVINO at all. According to analysis above, such report can't be treated as a real product memory leak. They suggest using `sanitizers` or `valgrind` tools as more reliable tools to check the memory leakage.

 

More details about how we are tracking memory leaks may be found in the link below:

https://github.com/openvinotoolkit/openvino/blob/master/docs/optimization_guide/memory_optimization_guide.md?plain=1#L28

 

 

Regards,

Peh

North-man
New Contributor I
3,614 Views

Hi Peh,
Thank you for your report.

 

Surely it happens just by defining gflags like below.


gflags::ParseCommandLineNonHelpFlags(&argc, &argv, true);

 

Ok, I'll try using 'address-sanitizer' or 'valgrind' to check.

I will contact you again if there are any points that I am not satisfied with.

Thank you.

 

Regards,

North-man

 

0 Kudos
Aznie_Intel
Moderator
3,570 Views

Hi North-man,

 

This thread will no longer be monitored since we have provided the information. If you need any additional information from Intel, please submit a new question. 

 

 

Regards,

Aznie


0 Kudos
Reply