OpenViBE forum

The OpenViBE community
It is currently Wed Jan 29, 2020 5:31 am

All times are UTC

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

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.
for (vector<ILogListener*>::iterator itLogListener=m_vListener.begin();itLogListener!=m_vListener.end();)

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().
std::vector < CSignalChannelDisplay* >::iterator it;
for (it=m_oChannelDisplay.begin();it!=m_oChannelDisplay.end();it++)
   delete (*it);
delete m_pBottomRuler;

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.
vector < IPluginModule* >::iterator k;
for(k=m_vPluginModule.begin(); k!=m_vPluginModule.end(); k++)
   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;
for (it=m_vVisualisationWidget.begin();it!=m_vVisualisationWidget.end();it++)
   delete (*it).second;

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

Joined: Tue Dec 04, 2012 3:53 pm
Posts: 778
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.


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 1 guest

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.