Not yet rated

Problem

Sometimes developers leave clearInterval functions and references open, even if movieclips are unloaded. clearlInterval will always retain the reference causing what looks like a memory leak.

Solution

Always call clearInterval.

Detailed explanation

Clear intervals SetIntervals are global functions of the flashlite player, even if a movieclip that called the setInterval is unloaded, the intervals stays active until it is cleared. The content needs to call clearInterval before unload movie to ensure all resources are cleaned up.

The player’s internal optimization lets movieclip swf data be shared by Actionscript function objects (FunctionScriptObject) and the swf data parser (ScriptPlayer). The swf data memory will not be recollected, if any ActionScript functions are still referring to the swf data, when the movie clip is unloaded. (SetInterval is one case such case.

The ActionScript function called on the interval points to the swf data. Therefore, if setInterval still exist the swf data will not be freed.)

+
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License. Permissions beyond the scope of this license, pertaining to the examples of code included within this work are available at Adobe.

Report abuse

Related recipes