11 Replies Latest reply on Mar 29, 2007 7:20 AM by kglad

    fixing memory leek

    Level 7
      Indeed a key listener not explicitly removed from the external swf before
      loading the internal swf into level0 causes memory leek.
      When I remover them the memory consumption raises with time much slower, but
      still raise. It looks like there is something else there.
      Apart from listeners what other things in the external swf I need to
      explisitly remove-delete-destroy before loading another swf?


        • 1. Re: fixing memory leek
          kglad Adobe Community Professional & MVP
          all listeners. and probably components. i blame components for all sorts of evil things.
          • 2. Re: fixing memory leek
            Level 7
            I do not know what components rae in FLASH context. Is there a chance that I
            am using them inadvertently?

            Also someone suggested "to delete all object reference(mc, class ......)" -
            what does this mean? Do I need to run removeMovieClip() on every MovieClip
            I created, before loading another swf?


            "kglad" <webforumsuser@macromedia.com> wrote in message
            news:eubs1m$3ev$1@forums.macromedia.com...
            > all listeners. and probably components. i blame components for all sorts
            of evil things.


            • 3. Re: fixing memory leek
              kglad Adobe Community Professional & MVP
              no, movieclips are well-behaved. you don't need to remove them before replacing your _level0 swf.

              components are pre-coded movieclip classes that are only using if you dragged one out of the component panel and placed it on-stage. even if you then remove that component from the stage it will still be in your library and still cause problems.

              the textarea and stepper and combobox are examples of components.
              • 4. Re: fixing memory leek
                anonymous thing Level 1
                you must debug your code... the problem is probably in your swf child.

                - First thing to do : COMMENT EVERYTHING in your child swf. When I say everything is really everything even variables declaration!!!

                - Next step : run your parent movie and load child swf. Wait to see if memory increase a lot. If Yes, the problem is inside parent swf so debug it using the comment everything method... If No go to next step...

                - Third step : uncomment function by function and run parent swf to see exactly when memory increase.. I know it's long and creepy but it's a good way to find a glitch like your's in a code


                *** Repeat actions in the same order all the time. Debug and load only one swf at a time. Look carefully in all of your loop (for, while, for.... in, do... while) and put a trace before and after the loop...


                Finally come back to the forum to post feedback about your problem in the same topic please....

                Good luck!
                • 5. Re: fixing memory leek
                  Level 7
                  This does not apply to textfields created using Insert-->NewSymbol and then
                  dragged to the stage from the Library, or to textfields created with
                  createTextField does it?

                  "kglad" <webforumsuser@macromedia.com> wrote in message
                  news:eubts8$5oj$1@forums.macromedia.com...
                  > no, movieclips are well-behaved. you don't need to remove them before
                  > replacing your _level0 swf.
                  >
                  > components are pre-coded movieclip classes that are only using if you
                  dragged
                  > one out of the component panel and placed it on-stage. even if you then
                  remove
                  > that component from the stage it will still be in your library and still
                  cause
                  > problems.
                  >
                  > the textarea and stepper and combobox are examples of components.
                  >


                  • 6. Re: fixing memory leek
                    Level 7
                    Yes, I seem to have to go this way. Do I also need to remove everything from
                    the stage and/or from the Library - I might have inserted MCs which have AS

                    "anonymous thing" <webforumsuser@macromedia.com> wrote in message
                    news:euc3je$d1e$1@forums.macromedia.com...
                    > you must debug your code... the problem is probably in your swf child.
                    >
                    > - First thing to do : COMMENT EVERYTHING in your child swf. When I say
                    > everything is really everything even variables declaration!!!
                    >
                    > - Next step : run your parent movie and load child swf. Wait to see if
                    memory
                    > increase a lot. If Yes, the problem is inside parent swf so debug it using
                    the
                    > comment everything method... If No go to next step...
                    >
                    > - Third step : uncomment function by function and run parent swf to see
                    > exactly when memory increase.. I know it's long and creepy but it's a good
                    way
                    > to find a glitch like your's in a code
                    >
                    >
                    > *** Repeat actions in the same order all the time. Debug and load only
                    one swf
                    > at a time. Look carefully in all of your loop (for, while, for.... in,
                    do...
                    > while) and put a trace before and after the loop...
                    >
                    >
                    > Finally come back to the forum to post feedback about your problem in the
                    same
                    > topic please....
                    >
                    > Good luck!
                    >
                    >


                    • 7. Re: fixing memory leek
                      kglad Adobe Community Professional & MVP
                      if you've removed everything from your fla that has a listener (all components and listeners that you defined) and are still having a problem then look for any setIntervals that you defined and failed to clear.
                      • 8. Re: fixing memory leek
                        Level 7
                        Removing KeyListeners seems to sort the problem out. Thanks for help


                        • 9. Re: fixing memory leek
                          kglad Adobe Community Professional & MVP
                          you're welcome.
                          • 10. Re: fixing memory leek
                            Level 7
                            I do indeed have setIntervals and all they are cleared in line with the game
                            logic. Now I see that if the swf was reloaded before its logic cleared the
                            inteval, there is a problem - thank you for the hint

                            "kglad" <webforumsuser@macromedia.com> wrote in message
                            news:eued3b$e4j$1@forums.macromedia.com...
                            > if you've removed everything from your fla that has a listener (all
                            components
                            > and listeners that you defined) and are still having a problem then look
                            for
                            > any setIntervals that you defined and failed to clear.
                            >


                            • 11. Re: fixing memory leek
                              kglad Adobe Community Professional & MVP
                              you're welcome, again.