Techniques for cleaning up after closures in Flash (preventing memory leaks)
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

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.


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

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 
  3. Build

    mvn clean install