Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 10-05-2004, 05:59 PM   #1
Drakkon
Flash Connoisseur
 
Drakkon's Avatar
 
Join Date: Apr 2004
Posts: 195
Red face Program slows as time goes on...need suggestions

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)

So question is this: Is there any way to actionscript trace what variables are being used? 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.
Drakkon is offline   Reply With Quote
Old 10-06-2004, 07:57 PM   #2
Curly Brace
Rock is alive!
 
Curly Brace's Avatar
 
Join Date: Jun 2004
Location: Russia
Posts: 603
Send a message via ICQ to Curly Brace
Default

Howdy!
You've got very interesting problem! So, after 2 nights of fight with flash I've got some results
My first attempt (yesterday) was a try to use built-in watch func that allows to track variable changes, but I had no success with that (the script I tryed to track with my funcs become unworking). I believe that utilising that func is better way than mine.
So, what I have now is a script that tracks any variable value changes (in the whole movie, not just _root stage) and traces full path to those vars. Tested with mc's and objects (bug: when changing any object's property value it says only that object changes, no prop name specified). I guess arrays will be working like objects.

Funally, here's the code:
PHP Code:
function trackInit(tr_object) {
    for (
tr_prop in tr_object) {
        if (
tr_prop != "tr_objects") {
            
tr_objects.push([tr_objecttr_proptr_object[tr_prop]]);
            
trackInit(tr_object[tr_prop]);
        }
    }
}
function 
track() {
    
trace("\n");
    for (
tr_index in tr_objects) {
        if (
tr_objects[tr_index][0][tr_objects[tr_index][1]] != tr_objects[tr_index][2] && tr_objects[tr_index][1] != "tr_prop") {
            
trace(tr_objects[tr_index][0]+"."+tr_objects[tr_index][1]+"\t\t\t\t changed");
        }
    }
    
tr_objects = [];
    
trackInit(_root);
}
function 
startTracking(tr_rate) {
    
tr_objects = [];
    
trackInit(_root);
    
setInterval(tracktr_rate);

A little explanation:
To use all that stuff copy-paste all func's and call startTracking(check_rate_in_milliseconds) This will start outputing info about var using each check_rate_in_milliseconds milliseconds.

Have fun with that and tell me if you'll manage to make it faster or siplier.
Curly Brace is offline   Reply With Quote
Old 10-06-2004, 08:55 PM   #3
Drakkon
Flash Connoisseur
 
Drakkon's Avatar
 
Join Date: Apr 2004
Posts: 195
Default

interesting idea...i tried similar things but i just had too many variables to track (i was trying to push a var each time i created one).

funny though...barely 2 seconds into my program I get a "256 levels of recursion were exceeded in one action list." error and the rpogram halts

added another 2 Gigs of ram into comp though (making me up to 4 gigs) and finally got it to run in debug mode now to just sort through all the levels...

EDIT: Scratch that...just got a FLASH has used up all its availible memory message

Last edited by Drakkon; 10-06-2004 at 09:05 PM.
Drakkon is offline   Reply With Quote
Old 10-06-2004, 09:18 PM   #4
Curly Brace
Rock is alive!
 
Curly Brace's Avatar
 
Join Date: Jun 2004
Location: Russia
Posts: 603
Send a message via ICQ to Curly Brace
Default

Woah! Really hungry app!
Don't you afraid that common user's will have problems with it (eg I've got 256 MB)? Or you've got special auditory?
Curly Brace is offline   Reply With Quote
Old 10-06-2004, 11:05 PM   #5
annexion
I make out with chicks
 
Join Date: Oct 2002
Location: NYC
Posts: 1,586
Default

Check all your for and while loops as well as setIntervals. Depending on what actions are in them, running unchecked can produce loads of unwanted memory usage.
__________________
www.perpetuated.com
annexion is offline   Reply With Quote
Old 10-06-2004, 11:13 PM   #6
Drakkon
Flash Connoisseur
 
Drakkon's Avatar
 
Join Date: Apr 2004
Posts: 195
Default

I was handed this project when it was supposed to be like 80-90% complete. Luckly the specs for req are pretty high at 256mb and 800mhz proc but still...this is crazy...i have to fix it now so common users wont have probs

The XML object is a fickle beast...it seems to be massive when loading but once deleted it doesnt exactly get garabge collected right away. I assume something along these lines might be what is causing my mem leak...

no while loops, mostly for loops loading xml data. no setintervals used whatsoever. Have a couple pause screens and noticed CPU/mem usage stops when those are loaded so i know nothign in the background is leaking its only on load and resetting data i think.
Drakkon is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:02 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.