Sorry for this long post, but I'm asking for help here as a last resort
on a problem I've been grappling with for close to a month now. I've
spent the past 3 weeks trying to diagnose a performance problem in an
application I'm building. It's an AMFPHP front-end to the PHPLive web
support system. There's a PHPLive_Desktop class and a corresponding PHP
class in my AMFPHP services folder. I intantiate the PHPLive_Desktop
class and then call its methods to update my interface. The data is
returned and I dynamically place a movieclip for each row of data into a
list_container clip on my stage using
_root.list_container.attachMovie(args...). Each duplicated movieclip
displays a single row of data. When a user enters our web site, a new
row is created on the stage, which is then updated with the user's info
as the user travels our site. When they leave the site, the movieclip
for that user is destroyed using removeMovieClip() followed by
unloadMovie() just to be sure (have tried it with and without
unloadMovie with no observable difference). To control the placement of
the clips and have them move to their proper layout location as users
come and go, I was originally using a function attached to
onClipEvent(enterFrame) of each row movieclip. During testing I noticed
that memory and processor use would slowly grow over time and that
eventually the framerate was dropping so low that the whole application
slowed to a crawl. At first I assumed this was due to using too many
enterFrame events. If there were 30 users on the site, then I'd have 30
enterFrame function calls happening simultaneously. The strange thing
about it was that if the movie hadn't been running very long, then I
could easily have 50+ rows displaying without any performance issues.
It was only after about 10 minutes that things started to slow down and
it was happening regardless of whether I was displaying 2 rows or 50
rows. The only thing that seemed to have any effect was the length of
time the movie had been running. I assumed that I could fix it by using
a different method to lay out the clips (keep in mind that they have to
dynamically slide into new positions when new rows are added or deleted
from the display). So the first alternative I tried was attaching
2-frame looping controller clips to the rows as needed, then deleting
them when the rows reached their final position. I thought I'd licked
the problem. Further testing revealed that the problem remained. So then
I switched to my current implementation, using setInterval() to tell
each clip to call a single row_mover() function on my main timeline,
then removing the IntervalID from the clip when it reached its final
position. I was sure this was the solution, but after more testing the
problem remains. I've gone through my entire application and followed
everyone's recommendations for making sure I'm deleting every variable,
function reference, object, etc when I'm done with it. I've read every
related post I could find on this mailing list. The problem remains. 
 
Finally, yesterday, I created a button that will manually remove all the
rows from my display so that when the application slows down, I can
remove all the clips and force them to be reattached on the next server
query to see if the row movieclips have anything to do with the slowdown
or if it was some other part of my application. It turns out, that when
I click the button and manually delete all the rows from my display, it
fixes the problem. The clips are immediately redrawn and the application
functions again at normal speed for another 10 minutes, despite the fact
that all the rows are immediately replaced on the stage with identical
copies. There are no enterFrame events used inside any of the row
movieclips and only 3 used (on static clips) in the entire application.
So it seems that only one of two things could be happening at this
point. Either my row movieclips contain something that I cannot see that
is slowly eating up memory and CPU or there is some kind of bug in Flash
the flash player that makes it slow to a crawl if kept open for too
long. I have yet to find a definitive answer on whether Flash does or
does not have a memory leak (aside from that bitmap data problem
detailed by others).  Incidentally, the behavior is identical in both
the debug player and the standalone player. If I pass my movies through
MDM Zinc and make an executable, the memory use stops growing out of
control and the processor maxxes out at 50% instead of 100%, but the
performance issues are identical. Sometimes I'll even have the
performance problem when my CPU usage is reading 0-5%. There's a
disconnect somewhere between the CPU meter and the actual memory usage
of the Flash movie, regardless of the player verison used. It seems that
MDM Zinc, just hides the memory leakage problems from the
taskmanager...probably displaying the useage for the .exe wrapper and
not the embedded player. 
 
I know that other people on this list have had similar problems because
I've read their posts, but has anyone actually solved the problem? The
only thing I can think of that I haven't tried already is to rebuild the
row movieclip as a new symbol and see if that helps. Oh...and I forgot
to mention this is all done in Flash 8 Pro AS2 with some V2 components.
Tested in flash player 7-9 with same probs in all versions. 
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to