Home > closures-cleaning-example

closures-cleaning-example

Closures-cleaning-example is a project mainly written in ActionScript, it's free.

Techniques for cleaning up after closures in Flash (preventing memory leaks)

Cleaning up after closures in Flash

This example is an overview of various mechanisms to remove listeners to closures in Flash, thus preventing memory leaks.

Check out the blog post.

Usage

Run the various closure techniques via the application using Flashbuilder's Profiler. Check the usage of the MyTimer class (which is what we're testing). It will increase into a hundred instances (for each item) for all tests, and then after running GC manually, will decrease back to 0 instances.

Third party dependencies

  • As3-Signals v0.8

Setup instructions

  • Flashbuilder: Run the following maven goal to generate the project files from the pom.

      mvn org.sonatype.flexmojos:flexmojos-maven-plugin:3.9:flashbuilder 
  • IntelliJ: Use the import wizard

Build instructions

To build on your machine via Maven. Follow these steps:

  1. Ensure Maven 3.0.3 + is installed

  2. Install local dependencies (add them to your local repository)

     cd libs
    
     mvn install:install-file 
         -Dfile=as3-signals-0.8.swc 
         -DgroupId=org.osflash
         -DartifactId=as3-signals 
         -Dversion=0.8 
         -Dpackaging=swc
  3. Build

     mvn clean install