[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.

HTH,
-Alex

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
    remove?
    
    Is there a way to tell all event listeners to use weak references?
    
    
    
    --
    Sent from: https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fapache-flex-users.2333346.n4.nabble.com%2F&data=02%7C01%7Caharui%40adobe.com%7Caf9c1574056e4a6fd36408d5c1e8a0b7%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636628127235729630&sdata=BUHpt%2Ffh7WjMM7U6WAIq9VGMSeDsgNmvrgv8w4y7Loc%3D&reserved=0