Solved

Program slows as time goes on

Posted on 2004-10-05
5
141 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
  • 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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

I know the transition can be hard. We got used to the ease of use ActionScript 2 had, but honestly, it became problematic later on, especially if designers were involved in the project and found it easy to add code as they saw fit. So, this artic…
While working over numerous projects I often had the requirement for doing a screen capture in AS3.0. Unfortunately I found no "ready made" solutions in google search that suited my requirements. But I did come across some great resources which help…
The goal of the tutorial is to teach the user how to how to record live broadcast.
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.

760 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now