Jump to content

Search In
  • More options...
Find results that contain...
Find results in...

Scale effect memory leak

Recommended Posts

We have been using the Greensock library in an Adobe AIR application for a while now with really no problems.  We decided to try our Windows based application on an Android device and found that most things work quite well.  The only problem we are seeing with the Greensock library turns up when we use scale effects.  By this, I mean any time I attempt to scale a SplitTextField  from say 4 to 1, the system lags.  If I scale multiple SplitTextFields at once and by letter, then system can almost crash.  The board we are using is running one of the latest version of Android and is capable of  outputting HD content.


Below is the code for one of the animations being affected.  Each letter should scale down and rotate in, staggered.


// target is the object we are going to animate // time is the total amount of time for the animation

public static function MyEffect(target:SplitTextField, time:Number):TimelineMax{

// Activate plugins

TweenPlugin.activate([TransformAroundCenterPlugin, AutoAlphaPlugin]);

// Create new TimelineMax Object

var t:TimelineMax = new TimelineMax();

// Determine how long each letter should animate

var timePerHold:Number = time / target.textFields.length;

// Go through each textField in the SplitTextField and complete the following animation

for(var x:int = 0; x < target.textFields.length; x++){

 // Use 20% of the time to rotate the text and scale the text half way

 t.fromTo(target.textFields[x], timePerHold * .2, {transformAroundCenter:{scale:4, rotation:-180}, alpha:0}, {transformAroundCenter:{scale:2, rotation:0}, alpha:1});  // Use 80% of the time to finish scaling the text

 t.to(target.textFields[x],timePerHold * .8, {transformAroundCenter:{scale:1}, ease:Elastic.easeOut});


 return t;



This is causing a memory leak. I have isolated it to the transformAroundCenter plugin using the scale feature. Any ideas on how to eliminate this?

Link to comment
Share on other sites

Honestly that sounds more like a Flash Player bug, especially because:

  1. It works fine everywhere else except that one environment you mentioned
  2. The GSAP tools have been in wide circulation for years and years, but nobody else has reported a similar problem. 

I wonder if the problem has more to do with the complexity of animating the sheer number of characters that are split apart. 


I don't see anything that could be causing a memory leak in GreenSock's code. If you see evidence to the contrary, I'd be curious to see it. 

  • Like 1
Link to comment
Share on other sites

Thanks for the reply.


I checked this issue on a PC running Windows 7, had the same issue (therefore it is not an Android OS issue). As far as it being the number of characters, I would agree that the more characters split would use more memory - however I would hope that at the end of the animation the memory would be released.


I have tried these ideas to release the memory:

  1. When setting up a TimelineMax I always use the autoRemoveChildren (true) as an option
  2. In the constructor class (ex. PaidTextAnimations) I call TweenPlugin.activate for any plugins that are needed by that class
  3. At the end of the TimelineMax, I call the .clear() and then the .kill() functions and then set it to null

Do you have any other ideas as to how I could force the memory to be released?


Link to comment
Share on other sites

Are you checking the memory usage after like 10 seconds? Remember that you need to wait for around  2 seconds for things to be released internally. I'm concerned that perhaps you're trying to analyze the memory usage IMMEDIATELY after the animation is done. 


Beyond that, I'm not sure what to suggest. It's very difficult to troubleshoot blind. I wish I had a great answer for ya. 

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.