tpaviot / oce

OpenCASCADE Community Edition (OCE): a community driven fork of the Open CASCADE library.
http://groups.google.com/group/oce-dev
GNU Lesser General Public License v2.1
808 stars 284 forks source link

Maybe a memory leak in Standard.cxx #736

Closed labusi closed 3 years ago

labusi commented 3 years ago

In the Standard.cxx file, I'd like to know whether or not there should be a "delete myFMMgr" in the if block, It seems a memory leak issue.

Standard_MMgrFactory::~Standard_MMgrFactory()
{
  if (  myFMMgr )
    myFMMgr->Purge(Standard_True);
}
tpaviot commented 3 years ago

Hard to say. cppcheck does not report any issue

aothms commented 3 years ago

This is actually documented:

// Therefore holder currently does not call destructor of the memory manager // but only its method Purge() with Standard_True.

https://github.com/tpaviot/oce/blob/oce/patches/src/Standard/Standard.cxx#L203

Has to deal with construction and destruction of static definitions in different compilation units.

tpaviot commented 3 years ago

Thank you @aothms