Welcome, Guest
Want to take part in these discussions? Sign in if you have an account, or apply for one below
-
- CommentAuthorMikeBedar
- CommentTimeMar 10th 2012
I'm having an issue where I am doing several steps to remove particles after my effect is over and according to the memory profiler they are all stubbornly staying around.
Here is my cleanup code (copied largely from this forum):
//Removal Code
emitter.removeEventListener( ParticleEvent.PARTICLE_DEAD, particle_death_event, false)
emitter.stop();
ParticleCreator2D(emitter.particleFactory).clearAllParticles();
renderer.removeEmitter( emitter );
emitter = null;
removeChild( renderer );
renderer = null;
//
//And here is my creation code:
var new_particle:Particle2D = ParticleCreator2D(emitter.particleFactory).createParticle() as Particle2D;
new_particle.image = new Bitmap(tile_bmd);
new_particle.x = source_rect.x
new_particle.y = source_rect.y
emitter.addParticle( new_particle, true )
//
Is there another step that I am missing? After calling the removal code all of the particles are still in memory(forever) and each time I run this process, while the particles ARE being reused, I am still using more memory each time around.
Any help would be appreciated.
Also, is there a way I could be making new particles directly from the BMD? I know there is the big factory function, but I need non-square bitmap particles. -
- CommentAuthorRichard
- CommentTimeMar 18th 2012
The garbage colector only runs when the flash player needs more memory. So even though the data has been released, it will only be cleaned up when Flash runs the garbage collector and that may not be for some time.
Also, are you cleaning up the bitmap data from the particle images?
1 to 2 of 2
