[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Memory Leak

Unfortunately, you can't override event listeners in Flash.  But the framework code is theoretically designed to not cause pin modules in memory when used "properly".  The ComboBox dropdown probably isn't the culprit here, I was mainly using it to illustrate that your clean up code can't clean up everything.

There is another technique to try to figure out what is pinning the module in memory.  You can create a module loading test harness.  It loads the module using ModuleManager instead of ModuleLoader.  When the module loads, you run code that unloads it.  That tests that the module doesn't have any initialization code that is a problem.  If it doesn't unload, then you know to examine the initialization code in the module.  If it does unload, then you enhance the harness to put the module on the display list.  Then once it is on the display list, find some way to unload it without interacting with it, maybe a timer, or a button elsewhere in the UI.  That tests that the property validation code is a factor or not.  And so on.

Another technique I use is to stop in the debugger when the module doesn't unload and validate the number of children on the Stage, the SystemManager.rawChildren.  Because if something really is still attached at that level, that will be a problem.

BTW, are you using embedded fonts or remote classes that are unique to a module?  I think they can pin a module.  Anything that registers with a central registry.

It is rarely an easy or quick process, but maybe you'll see a pattern after a few modules so you will know where to look in the others.


On 5/24/18, 7:38 PM, "aceinc" <pauls@xxxxxxxxxxxx> wrote:

    Alex, I took a different but similar approach. I created a small class, and
    kept adding stuff to it until it failed. I determined it failed using the
    profiler. I did this back in December, but resolving this seems like it will
    take a fair amount of dedicated sleuthing. Large blocks of time can be hard
    to come by.
    So how would you resolve the issue where the drop down event listener is
    added to the stage? I assume this is an example of a number of similar
    things that can bite me in the butt.
    Can I override the event listeners in the stage? If so, how do I determine
    which events are pointing to things that I have removed, or am about to
    Is there a way to tell all event listeners to use weak references?
    Sent from:

( ! ) Warning: include(msgfooter.php): failed to open stream: No such file or directory in /var/www/git/apache-flex-development/msg02638.html on line 105
Call Stack
10.0010368520{main}( ).../msg02638.html:0

( ! ) Warning: include(): Failed opening 'msgfooter.php' for inclusion (include_path='.:/var/www/git') in /var/www/git/apache-flex-development/msg02638.html on line 105
Call Stack
10.0010368520{main}( ).../msg02638.html:0