View Full Version : 24/7 Memory Leak

02-17-2005, 11:58 AM
I have a (Flash MX 2004 pro) live news application that is going to be running 24/7 on an extremely large video screen, which is pulling in live data and images from 12 XML newsfeeds, all in different languages from around the globe, every 20 minutes or so, to display in a series of scripted animations. The news is interspersed with a series of embedded video sequences.

This amounts to a huge amount of data and image files, which need to be loaded up dynamically every day. My problem is therefore to do with memory leaks.

I have, as far as I can see, a very tightly controlled application, all classes, functions, objects, references and variables have been scoped carefully to avoid any unnecessary memory usage. I delete unused items, have no runaway numbers, no infinite loops, and data and XML objects are deleted as soon as the data is harvested from them.

Performance is absolutely fine after 24 hours, with no lag in any of the many scripted animated sequences. However, I have noticed that when the XML data is loaded, even though the XML object is clearly removed after each load and parse, upon inspection of the task manager, the memory usage has increased by what seems like a similar amount to the size of the XML files.

This amounts to 100mb of extra memory usage over 24 hours, which will become a problem unless the application is restarted.

Has anyone encountered similar problems with long-running applications?

02-17-2005, 12:18 PM
I haven't dealt with any Flash applications that needed to run for long period of times, but MM is pretty notorious for memory leaks, so I would assume that its a problem with the player. What you may want to try doing (and I dont know if this will even have any effect at all) is using loadMovieNum to load in the _url (the movie itself) back into level0 effectively restarting the application every 24 hours. This won't restart the player itself, just reload the swf playing in it... which is why Im not sure it will really do anything. :-/

02-17-2005, 01:02 PM
restarting the app is a very good idea. this can be acheived through javascript me thinks.

02-17-2005, 01:34 PM
I thought it might be the player. I can't see how it could be my scripting as it's as tight as a gnat's arse.

so much for flash handling memory allocation by itself then. I guess they never intended it to be as robust an application as I'm currently wanting.

I guess Flash's "garbage collector" (http://timotheegroleau.com/Flash/articles/scope_chain.htm) is not all it's cracked up to be.

02-17-2005, 01:39 PM
check out flashguru.co.uk, they have something simmiloiar going ...

02-17-2005, 01:43 PM
yeah, I saw that this morning, that graffiti business for MXDU, but not sure if it's handling anything as much as my app is. still, I guess it may be having similar probs, thanks

02-17-2005, 01:47 PM
i have always noticed that when loading xml the mem increases with the load. guy and peter are also loading xml, so even though it might not be the same load it might be usefull. also both off them are exremely accesible, and the app they are writing has MM's backing [read Mike chambers and mike downey have supper with them] so they might have some info u need.

but its still a longshot