www.genereAvventura.com hosts: AddEventSeeker, a FREE tool for AS3 developers by IlTimido.

addEvent SEEKER

What the application does

After having experienced serious memory leak problems in some applications and after a lot of testing and reading about garbage collecting issues in AS3 (see interesting links about GC issues at the bottom of this page), I learned that one of the biggest cause are listeners not removed: above all listeners created with strong references.
So I decided to write a simple application that scans one or more directories for actionscript files and checks their content to see whether or not every addEventListener has a corresponding removeEventListener set.
The application creates a log file containing detailed results about unmatched pairs.
Beyond checking in broad terms his own code, a programmer can use this program to get a sense of the code written by third parties in the case you have to load their assets or their modules in your main application (being stated you have access to the source code of these third parties).
It's my first application in Adobe Air: surely it could have been written better.
Maybe next time :D

How the application works

After having istalled the application, all you have to do is to select the root folder where your .as files are located and to select a folder for ouput logs.
Then press the button Start and wait for the process to complete (pic. 1).Pic. 1

The application creates a log file in the directory you have specified then
displays it (pic. 2).Pic. 2

Finally you can consult the log file in order to check potential problematic situations.
Please note that the application only read your files .as but does not modify them in any case!

What the application does not

  • Obviously the application cannot scan code written inside .fla files.
  • The application cannot understand if at run-time an addEventListener is called after or before his corresponding removeEventListener.

    Example:
    clip.removeEventListener(MouseEvent.CLICK,handler);
    ..
    clip.addEventListener(MouseEvent.CLICK,handler);
    In this case the application matches the listeners and no warning is reported.
  • The parser is really simple, so the application cannot handle well listeners that use functions in their arguments.

    Example:
    clip.addEventListener(MouseEvent.CLICK,addAsync(handler,100),false,0,true);
    In this case the listener will be marked as a strong reference also if it is not.
  • The parser analyzes the source code line by line, so the application cannot handle well code splitted on more than one line.

    Example:
    clip.addEventListener(MouseEvent.CLICK, handler);
    In this case the listener will result incomplete but no warning is reported.
  • The application cannot manage pairs of addEventListener/removeEventListener with different "signature".

    Example 1:
    clip.addEventListener(MouseEvent.CLICK,handler);
    ..
    ..
    var p_mc:MovieClip = clip;
    p_mc.removeEventListener(MouseEvent.CLICK,handler);
    Example 2:
    clip.addEventListener(MouseEvent.CLICK,handler);
    ..
    clip.removeEventListener("click",handler);
    and so on...
  • The application cannot manage as2 listeners
  • The application cannot improve my poor English :D

Interesting links about GC issues

gskinner.com: gBlog - Failure to Unload: Flash Player 9's Dirty Secret
Kirupa.com Forum - Garbage Collection: Reference Counting & Mark and Sweep
BIT-101 Blog - AS3 Garbage Collector Note
White Noise Blog - Garbage Collection in Flash AS3

Disclaimer

THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Contact

You can contact me by sending suggestions, complaints or whatever at:
iltimido@genereavventura.com

Download

If the express installation fails you can download the addeventseeker.zip installation file

To manually install Adobe® AIR™ runtime download the file for Windows or Mac OS

©2008 IlTimido - genereAvventura - Distribute under Creative Commons License Creative Commons License