OpenViBE forum

The OpenViBE community
It is currently Thu Dec 14, 2017 2:36 am

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Tue May 28, 2013 10:09 am 
Offline

Joined: Mon Mar 25, 2013 1:42 pm
Posts: 2
I have noticed a few memory leaks in the designer and some plugins. Herer is the list with some suggestions to correct them. I work with version14 but I checked if those issues were adressed in the last version.

1. openvibe-applications/designer/trunc/src/ovdCApplication.cpp : quitApplicationCB()
The commented lines at the end - after '// release the log manager and free the memory'- should be uncommented (bug it triggered fixed in next point)

2. Bug Fixed in last version : In openvibe-kernel-omk/trunc/src/openvibe-kernel/kernel/log/ovkCLogManager.cpp : removeListener()
If the pListener we want to remove is the last of the vector, we shouldn't do 'itLogListener++;'. Add a break to avoid it and I suggest we do a for loop instead of a while loop to avoid infinite recursion.
Code:
for (vector<ILogListener*>::iterator itLogListener=m_vListener.begin();itLogListener!=m_vListener.end();)
{
   if((*itLogListener)==pListener)
   {
      itLogListener=m_vListener.erase(itLogListener);
      l_bResult=true;
      break;
   }
   itLogListener++;
}


3. In openvibe-plugins/simple-visualisation/trunc/src/ovpCSignalDisplay/ovpCSignalDisplayView.cpp : ~SignalDisplayView()
The CSignalChannelDisplay objects referenced in the vector m_oChannelDisplay should be emptied - as we have 'm_oChannelDisplay[i] = new CSignalChannelDisplay(...)' and 'm_oChannelDisplay[i]->addChannel(i)' in init ()- and the bottom ruler destroyed - as we have 'm_pBottomRuler = new CBottomTimeRuler(...)' at the end of init().
Code:
std::vector < CSignalChannelDisplay* >::iterator it;
for (it=m_oChannelDisplay.begin();it!=m_oChannelDisplay.end();it++)
{
   (*it)->resetChannelList();
   delete (*it);
}
delete m_pBottomRuler;
m_pBottomRuler=NULL;


4. In openvibe-plugins/simple-visualisation/trunc/src/ovpCSignalDisplay/ovpCSignalDisplayLeftRuler.cpp : ~CSignalDisplayLeftRuler()
Remove the 'g_object_unref(m_pLeftRuler);'

5. openvibe-kernel-omk/trunc/src/openvibe-kernel/kernel/plugins/ovkCPluginModule.cpp
Add a ~CPluginModuleBase() virtual function to clear the m_vPluginObjectDescriptor - as we do pushbacks in getPluginObjectDescription().

6. openvibe-kernel-omk/trunc/src/openvibe-kernel/kernel/plugins/ovkCPluginManager.cpp : ~CPluginManager()
We need to empty the m_vPluginModule vector as it contains IPluginModules linked to CPluginModuleBase objects. Those objects should be uninitialized and deleted.
Therefore you can add at the end of the method the following instructions.
Code:
vector < IPluginModule* >::iterator k;
for(k=m_vPluginModule.begin(); k!=m_vPluginModule.end(); k++)
{
   (*k)->uninitialize();
   delete (*k);
}


7. In openvibe-kernel-omk/trunc/src/openvibe-kernel/kernel/visualisation/ovkCVisualisationTree.cpp : ~CVisualisationTree()
Add the following code right after the "TODO" to delete the CVisualisationWidget objects - that we add in 'addVisualisationWidget(...)' method.
std::map<OpenViBE::CIdentifier, OpenViBE::Kernel::IVisualisationWidget*>::iterator it;
Code:
for (it=m_vVisualisationWidget.begin();it!=m_vVisualisationWidget.end();it++)
{
   delete (*it).second;
}


Top
 Profile  
Reply with quote  
PostPosted: Mon Jul 01, 2013 8:44 am 
Offline

Joined: Tue Dec 04, 2012 3:53 pm
Posts: 599
Location: INRIA Rennes, FRANCE
Hi mhardin, many thanks for the suggestions. They had gone a bit under the radar for me, something wrong with my RSS. We'll try to incorporate them soon, not possibly to the next release (which is due this week), but to the SVN at least.


Cheers,
Jussi


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group
Americanized by Maƫl Soucaze.