Axonn Posted April 26, 2010 Share Posted April 26, 2010 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 comment Share on other sites More sharing options...
GreenSock Posted April 26, 2010 Share Posted April 26, 2010 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 comment Share on other sites More sharing options...
Axonn Posted April 26, 2010 Author Share Posted April 26, 2010 Yes, I noticed that ::- D. Just making sure though ::- D. Link to comment Share on other sites More sharing options...
focus Posted December 28, 2011 Share Posted December 28, 2011 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 comment Share on other sites More sharing options...
GreenSock Posted December 28, 2011 Share Posted December 28, 2011 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 comment Share on other sites More sharing options...
focus Posted December 29, 2011 Share Posted December 29, 2011 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 comment Share on other sites More sharing options...
GreenSock Posted December 29, 2011 Share Posted December 29, 2011 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 comment Share on other sites More sharing options...
focus Posted December 29, 2011 Share Posted December 29, 2011 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 comment Share on other sites More sharing options...
riawolf Posted January 6, 2012 Share Posted January 6, 2012 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 comment Share on other sites More sharing options...
GreenSock Posted January 6, 2012 Share Posted January 6, 2012 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 comment Share on other sites More sharing options...
davej Posted September 26, 2012 Share Posted September 26, 2012 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 comment Share on other sites More sharing options...
GreenSock Posted September 26, 2012 Share Posted September 26, 2012 A few questions for you: Does the same problem occur when you DON'T subload any swfs? Have you tried using a separate ApplicationDomain for your subloaded swfs? Are you using the latest version of TweenLite/Max? Are you maintaining references to any tween or TimelineLite/Max instances? 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 comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now