Fork me on GitHub
Not signed in (Sign In)

Welcome, Guest

Want to take part in these discussions? Sign in if you have an account, or apply for one below

    • CommentAuthorClark
    • CommentTimeJul 30th 2009 edited
     
    Hi everyone :)

    I have an issue at the moment where i am trying to optimise stuff as best i can.

    I found the profiler and im a total newbie with it but it seems that after i delete particles, things remain.

    Heres the profiler screenshot:

    When everything is active:
    http://www.scientificmastery.com/public/activeScreen.jpg

    After i thought i deleted everything:
    http://www.scientificmastery.com/public/deactiveScreen.jpg

    The code i have to clean everything up is:

    emitter1.stop();
    emitter2.stop();
    emitter3.stop();

    ParticleCreator2D(emitter1.particleFactory).clearAllParticles();
    ParticleCreator2D(emitter2.particleFactory).clearAllParticles();
    ParticleCreator2D(emitter3.particleFactory).clearAllParticles();

    render1.removeEmitter(emitter1);
    render1.removeEmitter(emitter2);
    render2.removeEmitter(emitter3);

    emitter1 = null;
    emitter2 = null;
    emitter3 = null;

    removeChild(render1);
    removeChild(render2);

    render1 = null;
    render2 = null;

    It seems that there is still many references to flint after this process. Especially it seems, the "new Image( PreloaderStarAsset)" which is the sprite (or movieclip) for each particle, its no longer on the display list, but remains for the duration of the rest of the application.

    Please understand that im just a junior and new to the profiler. I dont know if what i am seeing is just normal or negligable so pardon my ignorance but i felt it was worth asking about.

    Thanks.

    UPDATE:

    When i force garbage collection, its a completely different story for the PreloadStarsAssets... they are deleted but just not garbage collected. However, most of the org.flintparticles package still have an instance after forced garbage collection:

    1 Instance of (Emitter2d, Particles2d, frameUpdater, Explosion, RectangleZone, UpdateEvent, LifeTime.......) remains.

    Again this is probably completely negligable but i just wondered. Could it be that you need to remove the actions and initialisers on a emitter before deleting it?
    • CommentAuthorRichard
    • CommentTimeAug 8th 2009
     
    Quote: Could it be that you need to remove the actions and initialisers on a emitter before deleting it?

    You shouldn't need to. The mark and sweep garbage collection should handle it, provided there are no references to any of the se objects outside the emitter, and there are no references to the emitter.

    I couldn't load your images - not sure why - so the following could be way off.

    It sounds like there's still one reference to one emitter around, but I can't tell without seeing your code. This could in turn have references to all the actions and initializers and maybe one particle (hence the reference to Particles2D, which I'm assuming is a miss-type and should be Particle2D - there's no Particles2D class in Flint).

    Once you've started an emitter, you'll always have a single instance of FrameUpdater. This is the class that generates the frame tick used by all the emitters and is negligible in size. The tick itself stops if no emitters are using it.

    Richard