Detecting Memory Leaks?
- SomeFusion
- Gremlin
- Posts: 191
- Joined: Sun Dec 01, 2002 12:38 am
- x 3
Detecting Memory Leaks?
Hi
what do you use to detect memory leaks? Just the internal Ogre leak detection? I'm having the problem the ogreleak.log is detecting loads of leaks (the file is usally around 8 MB after closing my programm), Most of them seem to be related to the ParticleManager. The file points me to ogreparticlesystem.cpp(424) Ogre::ParticleSystem::increasePool. But there are some others that don't have a description available. Are those caused by me or Ogre?
I have the problem in my application I can shoot rockets but whenever I shoot one, the performance drops down for about 20 FPS and I don't know where its caused. Is it possible those leaks cause the problem?
what do you use to detect memory leaks? Just the internal Ogre leak detection? I'm having the problem the ogreleak.log is detecting loads of leaks (the file is usally around 8 MB after closing my programm), Most of them seem to be related to the ParticleManager. The file points me to ogreparticlesystem.cpp(424) Ogre::ParticleSystem::increasePool. But there are some others that don't have a description available. Are those caused by me or Ogre?
I have the problem in my application I can shoot rockets but whenever I shoot one, the performance drops down for about 20 FPS and I don't know where its caused. Is it possible those leaks cause the problem?
- tuan kuranes
- OGRE Retired Moderator

- Posts: 2653
- Joined: Wed Sep 24, 2003 8:07 am
- Location: Haute Garonne, France
- x 4
- Contact:
no it's not leaks that make the slowdown.
Check here to prevent slowdown on rocket launch: http://www.ogre3d.org/phpBB2/viewtopic. ... 4762#54762
Leaks are correclty reported by ogreleaks.
Perhaps this solution will also resolve your leaks, as you'll get a centralized pool of particle to release at the end of the program
Check here to prevent slowdown on rocket launch: http://www.ogre3d.org/phpBB2/viewtopic. ... 4762#54762
Leaks are correclty reported by ogreleaks.
Perhaps this solution will also resolve your leaks, as you'll get a centralized pool of particle to release at the end of the program
- SomeFusion
- Gremlin
- Posts: 191
- Joined: Sun Dec 01, 2002 12:38 am
- x 3
The Problem is not the ParticleSystem. I don't create something new at Runtime, only at loadtime. The only thing I do after a Rocket is fired is check whether the rocket is active or not and translate its node in the direction its heading. Its nothing that would slow down the game so much. I have no collision detection yet. If you want to try here's a precompiled version:
http://www.malwasandres.de/spacecleaner_0.02.rar
I'll try to setup a berlios.de account so I can use their svn server to store the source.
http://www.malwasandres.de/spacecleaner_0.02.rar
I'll try to setup a berlios.de account so I can use their svn server to store the source.
- tuan kuranes
- OGRE Retired Moderator

- Posts: 2653
- Joined: Wed Sep 24, 2003 8:07 am
- Location: Haute Garonne, France
- x 4
- Contact:
1- OgreLeaks are surely exact... You do have lots of memory leaks.
Do you release any pointer ? for shaderptr you need to set ptr.setNull () before ending appand and delete any newed object.
2- The way you manage particle system for engine boost seems not good at all... There nearly 100 particle on screen but ogreleaks says that you "increasePool" 100.000 times !!??? that means millions of particles allocated.... So there's a problem here.
3- Is the fps loss the same when you launch sphere or box instead of ninjas ?
Do you release any pointer ? for shaderptr you need to set ptr.setNull () before ending appand and delete any newed object.
2- The way you manage particle system for engine boost seems not good at all... There nearly 100 particle on screen but ogreleaks says that you "increasePool" 100.000 times !!??? that means millions of particles allocated.... So there's a problem here.
3- Is the fps loss the same when you launch sphere or box instead of ninjas ?
- SomeFusion
- Gremlin
- Posts: 191
- Joined: Sun Dec 01, 2002 12:38 am
- x 3
Do you mean sharedptr? I never used a sharedptr.tuan kuranes wrote:1- OgreLeaks are surely exact... You do have lots of memory leaks.
Do you release any pointer ? for shaderptr you need to set ptr.setNull () before ending appand and delete any newed object.
I don't know why there are so many calls to increasePool. I create the particle system at startup and incrase the particle count or decrease it depending on the engine. This is the code:tuan kuranes wrote: 2- The way you manage particle system for engine boost seems not good at all... There nearly 100 particle on screen but ogreleaks says that you "increasePool" 100.000 times !!??? that means millions of particles allocated.... So there's a problem here.
Code: Select all
if (!mEngineParticlesSet)
{
std::cout << "high" << std::endl;
mEngineParticlesSet = true;
mEngineEmitter->setEmissionRate(150);
mEngineEmitter->setMaxTimeToLive(0.9f);
mEngineEmitter->setMinTimeToLive(0.7f);
}
if (mEngineParticlesSet)
{
std::cout << "low" << std::endl;
mEngineParticlesSet = false;
mEngineEmitter->setEmissionRate(20);
mEngineEmitter->setMaxTimeToLive(0.5f);
mEngineEmitter->setMinTimeToLive(0.3f);
}
Hmm not as much as they do with ninjas. Is a fps loss for 10 normal for just one additional cube wich only translates in one direction?tuan kuranes wrote: 3- Is the fps loss the same when you launch sphere or box instead of ninjas ?
- tuan kuranes
- OGRE Retired Moderator

- Posts: 2653
- Joined: Wed Sep 24, 2003 8:07 am
- Location: Haute Garonne, France
- x 4
- Contact:
- SomeFusion
- Gremlin
- Posts: 191
- Joined: Sun Dec 01, 2002 12:38 am
- x 3
Thats the D3D9 Vertex Buffer bug disussed here:
http://www.ogre3d.org/phpBB2/viewtopic. ... tex+buffer
I'll take a newer CVS snapshot where this bug is fixed.
Btw, Sinbad was kind enough to change my name to something less stupid.
http://www.ogre3d.org/phpBB2/viewtopic. ... tex+buffer
I'll take a newer CVS snapshot where this bug is fixed.
Btw, Sinbad was kind enough to change my name to something less stupid.
- tuan kuranes
- OGRE Retired Moderator

- Posts: 2653
- Joined: Wed Sep 24, 2003 8:07 am
- Location: Haute Garonne, France
- x 4
- Contact:
tweaked your particle file to set a quota 10 and got a much readeable leaks file. Seems that you allocate 5 "players", each time creating a new particle system, with your 10.000 quota that gives the 50.000 increase pool.
After that, without source, hard to help much more.
Perhaps you're not exiting the App the right way, thus preventing Ogre to relase his internals objects.
After that, without source, hard to help much more.
Perhaps you're not exiting the App the right way, thus preventing Ogre to relase his internals objects.
- SomeFusion
- Gremlin
- Posts: 191
- Joined: Sun Dec 01, 2002 12:38 am
- x 3
- SomeFusion
- Gremlin
- Posts: 191
- Joined: Sun Dec 01, 2002 12:38 am
- x 3
Ok here is the source.
http://www.malwasandres.de/spacecleaner0.02source.rar
The Quota really was to high. But there are still to many memory leaks from the ParticleSystem. How do I shutdown the system correctly? At the moment i just return false in the frameStarted method.
http://www.malwasandres.de/spacecleaner0.02source.rar
The Quota really was to high. But there are still to many memory leaks from the ParticleSystem. How do I shutdown the system correctly? At the moment i just return false in the frameStarted method.
- tuan kuranes
- OGRE Retired Moderator

- Posts: 2653
- Joined: Wed Sep 24, 2003 8:07 am
- Location: Haute Garonne, France
- x 4
- Contact:
You should delete what you're allocating (and only that):
- in ~GameApp you should delete player asteroid...
- you should use mSmokeSystem->removeEmitter ParticleSystemManager::getSingleton().destroySystem
when deleting objects that had created particle system
- delete[] &mRockets and delete[] &mStage2 is wrong C++ when you do no allocate mStage2 and mRockets yourself.
- delete obj; objList.remove(obj); is in wrong order...
It's not meant to be rude, but you have to re-check some C++ basis (specially memory management), otherwise you'll have hard time.
I can assure you that it will be faster to check basis and then try to program, than try and debug without understanding what's happening.
For instance, read some on-line books (you'll learn some optimizations too):
http://www.rz.rwth-aachen.de/computing/ ... 1.18-1.pdf
Then some other readings here :
http://www.ogre3d.org/phpBB2/viewtopic. ... hlight=stl
- in ~GameApp you should delete player asteroid...
- you should use mSmokeSystem->removeEmitter ParticleSystemManager::getSingleton().destroySystem
when deleting objects that had created particle system
- delete[] &mRockets and delete[] &mStage2 is wrong C++ when you do no allocate mStage2 and mRockets yourself.
- delete obj; objList.remove(obj); is in wrong order...
It's not meant to be rude, but you have to re-check some C++ basis (specially memory management), otherwise you'll have hard time.
I can assure you that it will be faster to check basis and then try to program, than try and debug without understanding what's happening.
For instance, read some on-line books (you'll learn some optimizations too):
http://www.rz.rwth-aachen.de/computing/ ... 1.18-1.pdf
Then some other readings here :
http://www.ogre3d.org/phpBB2/viewtopic. ... hlight=stl
- SomeFusion
- Gremlin
- Posts: 191
- Joined: Sun Dec 01, 2002 12:38 am
- x 3