Solved

Program slows as time goes on

Posted on 2004-10-05
5
175 Views
Last Modified: 2010-04-03
So I have a rather large, multi swf application. Allows for all sorts of functionality, creates a ton of xml objects and arrays to swap data back and forth between movies all while tracking the user and all this other fun stuff.

Well anyways in final stages of development and its been noted that as people use the program for longer and longer periods of time it begins to slow itself down. It will take longer to bring up certain movieclips or it plays a video and takes longer to load. This usually occurs when the program is restarted multiple times (can be "restarted" from within the program). No setIntervals or onEnterFrmes on any of he swfs or mc's so i know its nothing like that running at least.

So question is this: Is there any way to actionscript trace what variables are being used without being in the debugger? I've deleted all i can think of in my restart procedure trying to clear up memory but it doesn't seem to be affecting much. Can't use the debugger because there are just WAY too many objects, mc's, variables and levels to deal with that flash crashes if i load in debug mode :(
0
Comment
Question by:Drakkon
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 10

Expert Comment

by:muso120999
ID: 12230567
> Is there any way to actionscript trace what variables are being used without being in the debugger?

If your page is in html, I tend to use:

getURL("javascript:alert(value = '" + myVariable + "');");

Or have a textbox in your clip, and add lines to it to trace.


> I've deleted all i can think of in my restart procedure trying to clear up memory

I've had a similar problem myself in the past, and due to the complexity, and timescale of the project, I ended up
having to clear-down by re-loading the page, and have a graphic in the background to hide as much as possible
this re-load.  It does get things running again.

Memory leaks can be difficult to source
0
 
LVL 4

Author Comment

by:Drakkon
ID: 12241451
i can test the program from within flash i just cant go into debug mode. So i can see the output window and any trace commands but i can't see whats going on with all variables at any given time like you can in debug mode.

Sadly this is a CD based app and thus can't exactly reload, im unloading layers but thats not seeming to clear up memory leaks. I'm not sure if its the flash garbage collector not doing its work or if its myself not deleting all possible variables. If there was just some way to see what variables were loaded for each level in the output window that would give me some indication....
0
 
LVL 10

Accepted Solution

by:
muso120999 earned 250 total points
ID: 12243119
This could do with some refining (I created it for another question to list the structure of an XML object), but it recurses through an object listing everything it finds:

showContent(this);

function showContent(obj:Object, oldProp:String) {
     var prop;
     for (prop in obj) {
          if ((typeof (obj[prop]) == "object")||(typeof (obj[prop]) == "function")) {
               var newProp = (oldProp==undefined) ? "["+prop+"]" : oldProp+"["+prop+"]";
                     trace(">> TYPE >> "+typeof (obj[prop]))
               trace(obj+newProp);
               showContent(obj[prop],newProp);
          } else {
                     trace(" -- "+typeof (obj[prop])+": "+prop+" = "+obj[prop]);
          }
     }
}


Just use showContent(myObject);

I hope it can be of some use to you.
0
 
LVL 4

Author Comment

by:Drakkon
ID: 12324015
thanx for the code there...helped definately in finding what variables were on each level. silly thing though would get caught too many levels of recursion but thats more my fault then anything :D well thanx anyways!
0
 
LVL 10

Expert Comment

by:muso120999
ID: 12324125
Oh yeah, only 256 levels of recursion!

Glad it helped though :-)
0

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a very simple example to help those of you who are still migrating from AS2 to AS3 understand the redesigned event model in AS3. In AS2.0, event functions (that is, the function to be performed when an event is fired) were stored as a pro…
In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question