Jump to content


Memory leak

Recommended Posts



I'm using Greensock in my application and recently I joined the club.


I now do some profiling on my application because there's a memory leak and I'm trying to find it.


I am using a custom static class I have found here.


Basically, I add an instance of an object I want to track to a Dictionary that constructed with weakKeys set to true, and then after I remove the object the tool calls System.gc 4 times and then prints all the keys that are still exists in the dictionary.


To make things short, if I tween the object, there's still exists a reference to the object, while if I don't tween, there isn't.


I even tried to kill the tween but It didn't change a thing,


Is there a fix or am I doing something wrong here?



Link to comment
Share on other sites

From what I've read (and things may have changed since then), you can't really rely on System.gc working - it apparently does in the debugger version of Flash Player, but not in the regular player. 


As a speed optimization, the tweening engine does keep a reference of the target for about 2 seconds after its last tween finishes (or is killed), so please do your testing with that in mind. It sounds like maybe that's it (and that's not a bug or memory leak - it was very purposeful since speed is so critical to animation libraries). Maybe try running your System.gc after 3 or 4 seconds and see if that gives you the results you expect.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.