memory leak in CCParticleExamples


Hi everyone,

I am trying to add some particles to my game, but I suffer memory leaks. I thought it was my fault, but when I am trying the “particle test” example in the “tests” application given with the cocos2d-x package, it seems that there is a memory leak. When switching from a particle example to another (fire to galaxy, etc.) with clicking the big green arrow, some memory is not freed. Under the windows task manager, the memory used by “tests.exe” increases progressively everytime I click on the green arrow.

Apparently I am not the only one having this problem, like in the post here:

Do you have a solution for this issue?

thanks for your help


I checked the ParticleTest and did not find memory leak by vld tool. I looked at the windows task manager, the memory did increase, but it’s not because of memory leak.
I think it’s the reason of calling ‘CCTextureCache::sharedTextureCache()->addImage(s_fire)’ when switch the demo. Different textures are cached in CCTextureCache.


Thank you for your answer.

I modified my code to only call the ’CCTextureCache::sharedTextureCache()>addImage’ once, and to share the same CCTexture2D object between all my particles instances, when calling particle>setTexture( … ).

It improved the memory of the program, but I still have a some memory that is not freed every time I create and delete a particle object… around 100 kbytes each time. The memory is allocated when calling CCParticleBlood::node().

Do you have an idea on this?


when I try my code on XCODE instead of visual studio, I do not have any leak at all. So maybe it’s just windows…
That solves my problem.


May be you should refer
On win32, there is memory leak caused by opengles lib.
If possible, please test it on iOS.