Solved

Program slows as time goes on

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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Suggested Solutions

Sometimes you know that one object has a specific child in it, but you can't find the child. This happened to me when I was trying to code some actionScript to make a toolbar work with its embedded buttons.  My partner had created the toolbar usi…
Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
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…
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.

777 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