Page 1 of 1

memory leak

Posted: Thu Oct 04, 2012 07:15
by gjaegy
Hi,

I am using the latest source code (1.x branch) from the repository. I am having some issue trying to fix a memory leak, which I think might be a Cegui internal leak.

Below the leaks produced :

http://g.jaegy.free.fr/_divers/leaks.txt

The leak can be reproduced using the simple code below:

Code: Select all

      CEGUI::System& system = CEGUI::System::getSingleton();
      CEGUI::SchemeManager& schemeMgr = CEGUI::SchemeManager::getSingleton();
      CEGUI::WindowManager& winMgr = CEGUI::WindowManager::getSingleton();

      CEGUI::Scheme& scheme = schemeMgr.createFromFile("AlfiskoSkin.scheme");;
      CEGUI::Window* window = winMgr.loadLayoutFromFile("ADTTuning.layout");
      CEGUI::Window* root = system.getDefaultGUIContext().getRootWindow();
      root->addChild(window);
      root->removeChild(window);
      winMgr.destroyWindow(window);


Below is the simple layout file used:
http://g.jaegy.free.fr/_divers/ADTTuning.layout

The leak seems to be created when the "UnifiedDim::clone()" method gets called by the expat parser, while loading the .scheme file:

Code: Select all

BaseDim* UnifiedDim::clone() const
{
    UnifiedDim* ndim = CEGUI_NEW_AO UnifiedDim(d_value, d_what);
    return ndim;
}


This method being called by OperatorDim::setNextOperand().

I would say that the OperatorDim class should have a destructor, which delete its "d_left" and "d_right" members, no ?

Any idea ?