View Full Version : Correct way to dispose of / delete a load mask?

whirling dervish
29 Jan 2013, 8:15 AM
So I have been playing with loading masks for my application and currently I am using .hide(), but it seems like the loading mask object will just remain attached to the associated component and accumulate over time.

I am unsure of how I should be disposing of loading masks, or even if I need to dispose of them in the first place.

29 Jan 2013, 6:34 PM
There is the potential for a leak here if you aren't careful. Hiding a loadmask won't destroy it, so if you keep creating and hiding loadmasks they'll leak. This type of leak is quite common with menus too, where hiding is often automatic but destruction isn't.

Personally I try to use the setLoading method where possible:


If you can't use that for some reason then you'll probably need to manage loadmask destruction yourself. Depending on your circumstances this may be as simple as calling destroy instead of hide.

When I'm trying to test leaks I generally poll the value of:


If you have a component leak it'll be reflected in that count.

whirling dervish
30 Jan 2013, 7:47 AM
Thanks, that is really helpful.