I create a particle effect in the following way:
CCParticleSun* p = [[CCParticleSun alloc]initWithTotalParticles:5000];
p.autoRemoveOnFinish = YES;
//more parameters
p.duration = 1;
and add it to my scene:
[self addChild:p z:self.zOrder+1];
Every time I create this particle effect, 3MB of memory are allocated, but never released. What am I doing wrong? Do I have to manually release the particle system?
NSZombies are disabled, so it's not kept in memory by accident.
Everything you alloc (or retain) you have to release as well. For Cocos2D it's easiest to turn it into an autorelease object like this:
CCParticleSun* p = [[CCParticleSun alloc]initWithTotalParticles:5000];
[p autorelease];
p.autoRemoveOnFinish = YES;
p.duration = 1;
Then it will be released after Cocos2D cleans up your scene.
PS: 5000 particles is a GIGANTIC amount of particles! No wonder you're seeing allocations of several megabytes in size. Try going for 500 at most, 100 or less if you're using particle textures that are about 32x32 pixels or greater.