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

    • CommentAuthorevo
    • CommentTimeOct 6th 2011
     
    Hey, first I want to say that I love the Flint engine and I'm sure I will be using it a ton in the future!

    I guess I'll start by showing a picture explaining the issue:



    At the top if my memory usage profiler (Flashdevelop). Middle are the "Live Objects" Max Count / Current Count / Memory. Last is my code.

    In the memory profiler pic you can see a seesaw during the first third, this is before the emitter is created. After that I create the emitter and you can see the memory steadily increase. While watching the Live Object viewer I could see that PortalBlueDot Count (2nd column) was pretty much increasing/decreasing in sync with what the profiler shows. It does this until reaching a Max Count (which I assume is the maximum objects of this type alive at any one time) of 1500 than does the complete drop off you see at the end of the profiler. From then on the current count stayed around 300, expected for 100 particles/sec with a lifetime of 2-3, right?

    What I'm trying to figure out is what caused the large buildup of extra particles when they weren't required, what triggered the "evening out" of memory usage, and finally how can I prevent the buildup and keep the particle creation "steady" as the counter name implies?

    Additional info:

    PortalDotBlue is a simple 5px circular sprite created in Flash CS4.
    This entire process was done with the application running idle with the exception of me clicking to start the emitter.

    Thanks in advance!
    • CommentAuthorevo
    • CommentTimeOct 8th 2011
     
    Analyzing things again it seems that the number of particles being created is working fine, never getting much about 300 (as shown by Particle2d's count)... it's that the graphic being used in creation of these particles (Portal2d) isn't being cleaned up properly or something of that nature. Is it a problem with Flash's built in garbage collection system? Is there any way to use a single graphical object for ALL particles? Each particle is identical anyway so what's the point in giving each it's own graphic when there could just be one "master graphic" usable by all?
    • CommentAuthorRichard
    • CommentTimeOct 16th 2011
     
    If you use the BitmapRenderer then yes, you can use a single instance of the display object for all renderers. To do this, use the SharedImage initializer instead of the ImageClass initializer.