Use default operator new / delete in C ++ when it is redefined globally?

I am currently trying to work with two open source projects (OBS and OpenCV), but here I ran into a problem.

For a better understanding, OBS overrides the new and delete function. And this does not get along with the object from OpenCV. This causes some segmentation error that I cannot understand.

So, is it possible to use the new function and delete by default in a specific section of the code? The use of OpenCV in my project is limited by flow, therefore, if I can tell the compiler, I want to use the new one by default and delete it for a specific function, then everything should be fine. I am wondering if it is possible to do this with a namespace, but I'm not familiar with C ++ at all, so I have no knowledge on how to do this.

To give more detailed information about the problem I encountered, I use OpenCV 2.4.11 (tried 3.0.0, but this is basically the same situation), Visual Studio 2013 under Win 7 x64. When I dynamically link the library to OBS, the face detection thread (which I need to call OpenCV) generates a segmentation error when deleting some objects. When I statically link the library (a suggestion from others), the program crashes when launched inside the OpenCV code with some dynamic initialization, because the configured memory manager has not yet been initialized.

There were other issues close to what I came across, but they don't seem to solve the problem. I will leave the links here: Ignore globally redefined new / delete , the library forces new / delete global overloads on me!

The OBS link I am using is here https://github.com/jp9000/OBS/commit/9ab069c961c768fcdbc53b8ab2cd58540e1ee1f0

+5
source share

Source: https://habr.com/ru/post/1243638/


All Articles