Jump to content
GreenSock

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

PropTween

Recommended Posts

Hey. I have some performance issues with my AS3 application so I profiled it. I found 156 instances of TweenLite and 336 of PropTween. How can I delete / clear that stuff? I must use "killTweensOf"? No other way? Doesn't it do some of this stuff automatically when a tween is over? ::- )

Link to post
Share on other sites

Yes, absolutely. TweenLite cleans up after itself. You don't need to worry about manually keeping track of all the instances and killing them. Just give the Flash Player's garbage collection routine time to kick in.

Link to post
Share on other sites

Yes, I noticed that ::- D. Just making sure though ::- D.

Link to post
Share on other sites
  • 1 year later...

Hi! With help of profiler, I'm noticed PropTween is trashing memory constantly if I have some looped TweenLites on scene. This is really annoying on mobile devices because it forces garbage to keep growing and GC to work what leads to the FPS drops =(

 

I should mention how Animator lopped them:

 

_in();
function _in():void
{
TweenLite.to(this, spd_02, {scaleX:1.2, scaleY:0.8, ease:Sine.easeInOut, onComplete: _out});
}

function _out():void
{
TweenLite.to(this, spd_02, {scaleX:1.0, scaleY:1.0, ease:Sine.easeInOut, onComplete: _in});
}

 

I know there are repeats and yoyo available in TweenMax, but looks like PropTween still trashes the memory even with yoyo and repeats=-1 =(

 

Please, let me know if there is some kind of workaround exists for this case, thanks!

Link to post
Share on other sites

It is "trashing memory constantly"? Really? Could you explain what you mean exactly by that? Are you saying that you think there's a problem internally with the engine such that it is creating way too many instances abnormally or are you saying that you'd like to know if there's a way to write your tweening code to reduce the number of instances?

 

For the record, a PropTween instance must be created for each property that you're tweening - there's no way around that. Every tweening engine worth its weight would have to do the same kind of thing. That's where it records the starting/ending values and various other pieces of data. So it is totally normal for there to be several PropTween instances for each tween. In your case, there'd be 2 for each tween. I can't fathom how that would translate into "thrashing memory constantly" though. They don't use much memory and they are released for garbage collection when they aren't needed anymore. Some extensive testing has been done for gc effectiveness by some experts on the matter, and TweenLite/Max were confirmed to do great.

 

Here's a more efficient way to do your particular tweens:

 

var tween:TweenLite = new TweenLite(this, spd_02, {scaleX:1.2, scaleY:1.2, ease:Sine.easeInOut, onComplete:yoyoTween, onReverseComplete:yoyoTween});
function yoyoTween():void {
   tween.reversed = !tween.reversed;
   tween.resume();
}

Link to post
Share on other sites

Thanks for your answer! Nice hint about looping the tween!

By "trashing memory constantly" I mean PropTween is growing constantly, up to very huge amount before collecting by GC. 5 minutes of waiting on the screen with 10 looped tweens can store more then 10 000 PropTween instances in the memory according to the profiler...

Here is a part of memory profiling data with 3 columns for the one frame render:

 

Added Removed Current

 

Array

0 0 71

Object

18 0 175

com.greensock.core::PropTween

37 0 11980

flash.events::Event

12 12 25

com.greensock::TweenLite

9 0 47

 

Current - is an amount of instances currently in the memory.

So, looks like PropTween is added on every frame, but not collected at all or collected too slow to keep it's count constant.

 

I tried to profile your speed test swf, and there is interesting thing - FAST tests have no this issue, usual tests - have it.

Please, look at the TheMiner memory profiler via PreloadSWF (http://www.sociodox.com/theminer/support.html) on your speed test to see what I see...

Maybe it's a bug in the profiler and it just don't "see" how PropTween instances are collected?

 

Thanks!

Link to post
Share on other sites

Yeah, that sure sounds like a bug in the profiler you're using. I just tested your code in the Flex profiler and it worked great. No problems at all - no buildup of thousands of instances.

Link to post
Share on other sites

Thanks once again!

You're right! Just tested my swf with FlashDevelop profiler and there are no any issues with PropTween too, I'll report a bug to the TheMiner author.

Link to post
Share on other sites
  • 2 weeks later...
Yeah, that sure sounds like a bug in the profiler you're using. I just tested your code in the Flex profiler and it worked great. No problems at all - no buildup of thousands of instances.

I too have the same problem, and i tested it with preload profiler and with flashdevelop profiler. With flash develop profiler i can even look inside the PropTween Objects. While it is not a memory leak, but something funky is going on in there. When i leave the player alone for 5 min, the values are there and im tracing trace("current memory:", System.totalMemory); i get current memory: 16412672, all tweens are done, 5 min idle etc. However after forcing GC trace result immediately drops to current memory: 15040512. And PropTween count and memory values drop to 0. Why is it that flash player waits until forced to GC, 5min+ doing nothing? Id does clear other objects but not PropTween

Link to post
Share on other sites

That would be a question for Adobe - unfortunately I'm not privy to exactly what algorithm they use to determine when gc runs in the Flash Player and what depth it goes each time or how the schedule is worked out. But what I have seen is that gc does kick in eventually and things are cleaned up. I'm not aware of any memory leaks or issues in GreenSock tools like TweenLite/Max.

Link to post
Share on other sites
  • 8 months later...

I wish I had more detailed code but I am running a fairly large complex project that loads lots of stuff. I am having the same problem with PropTween. In 30 minutes of running it created a total of 19980 cumulative instances and left 1755 instances in existence of PropTween. We do run gb colecters every so often to force clean but that does not seem to help. The app loads swf and images via specific classes which then are destroyed and destroy all objects in them. Is there any way to force PropTween to destroy or any help would be good. This is a desk top app so I am not able post link.

Link to post
Share on other sites

A few questions for you:

  1. Does the same problem occur when you DON'T subload any swfs?
  2. Have you tried using a separate ApplicationDomain for your subloaded swfs?
  3. Are you using the latest version of TweenLite/Max?
  4. Are you maintaining references to any tween or TimelineLite/Max instances?
  5. Can you post a very simple FLA that reproduces the issue so that we can publish it on our end and see what's happening?

Link to post
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.

×