Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email?
March 12, 2010, 09:27:15 AM
Home
Forum
Documentation
Search
Help
Login
Register
Gaia Framework for Adobe Flash
>
Forum
>
Support
>
Gaia AS3 Support
>
AS3: Important To Know About Unloading Pages/Assets
Pages: [
1
]
« previous
next »
Print
Author
Topic: AS3: Important To Know About Unloading Pages/Assets (Read 3021 times)
steven
Gaia Author
Administrator
Gaia Evangelist
Posts: 3185
AS3: Important To Know About Unloading Pages/Assets
«
on:
April 07, 2008, 03:21:22 PM »
http://www.gskinner.com/blog/archives/2008/04/failure_to_unlo.html
"Flash Player 9 has a very dirty secret. It doesn't even try hide this dirty secret, but it's still not that widely known. You see, Flash Player has severe problems with separation anxiety - once it's loaded some content, it has a really hard time ever letting it go. Technically speaking, it is extremely difficult to make Flash Player 9 unload ActionScript 3 content."
Required reading if you're developing with Gaia AS3.
«
Last Edit: July 11, 2008, 02:43:33 PM by steven
»
Logged
Steven Sacks | Gaia Author
Please support Gaia by
donating to the project!
Jason.Dias
Gaia Novice
Posts: 7
Re: AS3: Important To Know About Unloading Pages/Assets
«
Reply #1 on:
May 15, 2008, 10:50:37 PM »
Does GAIA use weak references on its event listeners?
Logged
steven
Gaia Author
Administrator
Gaia Evangelist
Posts: 3185
Re: AS3: Important To Know About Unloading Pages/Assets
«
Reply #2 on:
May 15, 2008, 11:40:02 PM »
Where appropriate. I am well aware of the issues surrounding listeners. Thank you for asking, though.
Logged
Steven Sacks | Gaia Author
Please support Gaia by
donating to the project!
Roman Ivanov
Gaia Novice
Posts: 1
Re: AS3: Important To Know About Unloading Pages/Assets
«
Reply #3 on:
May 23, 2009, 03:46:58 PM »
steven, i bet you read articles at gskinner.com
please give us a guideline or just a short recommendation for workaround unloading problem.
I've tested the most recent site in Gallery - "Mercedes-Benz AMG" and I'm not happy with results.
IE 6.0, Flash Player 10 (debug version) - iexplore.exe memory usage 700Mb, then GC-ed to 100Mb and so on.
FF 3.0, Flash Player 10 (debug version) - firefox.exe memory usage 1.2Gb, then quit by exception.
FF 3.0, Flash Player 10 - firefox.exe memory usage 523Mb, stopped loading pages, perhaps after unhandled AS exception.
I have a simple idea how to solve it. In short:
"If unloading don't work - do not unload at all. Just
pause
loaded module process, and remove it from stage."
If user loads the section again - add it back to stage and
resume
.
So, when developing a section, I just write 2 handlers - pause and resume.
Pause - remove ENTER_FRAME listeners (if using something like Box2d) and stop timers - to free up CPU.
Resume - assign ENTER_FRAME listeners and start timers.
I plan to use this paradigm on my next project.
«
Last Edit: May 23, 2009, 10:05:17 PM by Roman Ivanov
»
Logged
steven
Gaia Author
Administrator
Gaia Evangelist
Posts: 3185
Re: AS3: Important To Know About Unloading Pages/Assets
«
Reply #4 on:
May 24, 2009, 07:55:40 AM »
"If unloading does not work"
There's no way to know if unloading does not work. GC does not run instantly, and the very nature of putting anything in place to check if something is unloaded means you're keeping a reference to it, and therefore it can't unload.
You have to clean up your swfs. There's no way around it.
Also, the debug player is MUCH slower than the regular player. You should never judge your site's performance based on the debug player.
«
Last Edit: May 24, 2009, 09:59:16 AM by steven
»
Logged
Steven Sacks | Gaia Author
Please support Gaia by
donating to the project!
akrobata79
Gaia User
Posts: 17
Re: AS3: Important To Know About Unloading Pages/Assets
«
Reply #5 on:
October 17, 2009, 08:22:21 PM »
hi All,
I recently have been developing a full website in as3 and ran into some serious memory management issues while trying to incorporate few components i bought at flashden.
Basically what I am trying to do is have a one pretty advanced video gallery in About Us section, then another component (banner rotator) in Home section etc..
It all works well, I managed to have the components load into appropriate sections and at first it seems everything is OK. But after a while what is happening is those components never unload from the main movie. They dissapear when I am going into another section, but STAY IN MEMORY which absolutely sucks. Things slow down, and make the website not easy to use.
Now this gives me 3 options:
1. Make sure everything is unloaded correctly before I go into anther section, which as you might know is not so simple in as3 as it is in as2 and it borderlines absolute horror, it might be additionally hard since I would have to dig into each component I am planing on using and making sure all event listeners, movieclips etc are unloaded before disappearing, --- hmmm, I think I'll pass on this one
2.Write those components from scratch, this way it's easier for me to have controll over what's going on in each one, and hope I'll do a good job of unloading them --- that would be the best option but it would require me to spend way too much time, I want to have a life
3.Now I kind of like this solution the best (Stevens link above)
GS says:
Load content into a div layered over your main application. This isn't a great option, but it addresses almost all of the issues.
now this gave me an idea... how about setting one div in my html that would hold my main movie and also setting another div right above that would essentially be a CONTAINER for any 3rd party components I am trying to load in.
Of course this approach would have some restrictions and wouldn't be as comfortable as simply loading a .swf into .swf, but surely would solve memory management issues and could be reused in another websites I am planning on building..
Way it would work is this:
- I have my main .swf movie in a div called MAIN_DIV
- in my html I create a div called TOP_DIV and place it on top of my MAIN_DIV
- When I go into About Us section, mymain .swf does its usual thing + it calls a Javascript function that loads an external swf into TOP_DIV (I am a newbie to this website stuff, but I would imagine some .asp + javascript would have to be implemented here)
- when I go to Home section I call another javascript function that unloads whatever's currently in TOP_DIV, then myMain.swf switches to Home sections + loads an appropriate .swf into TOP_DIV and so on so on
this way top swf and main swf are separated, all memory issues are resolved
now this is my wishful thinking that this would be actually possible, and requiring additional languages (asp, java whathever's needed) would just make it more complicated, but still I think it would be worth trying out until we are stuck with flashplayer that does such a crappy job at unloading stuff
what do you think guys? possible? we sent a man to moon goddamn it, this must be a breeze compared to that
thx
Rob
Logged
viaria
Gaia User
Posts: 11
Re: AS3: Important To Know About Unloading Pages/Assets
«
Reply #6 on:
November 12, 2009, 04:08:16 PM »
OHAAAAAAAA!!!
Logged
Pages: [
1
]
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
Downloads and Information
-----------------------------
=> * Download Gaia *
=> Screencasts
=> Examples, Tips+Tricks, Mods and Utilities
-----------------------------
Discussion
-----------------------------
=> General
=> Feature Requests
=> Gallery
-----------------------------
Support
-----------------------------
=> General Gaia Support
=> Gaia AS3 Support
=> Gaia AS2 Support
=> hxGaia Support
-----------------------------
International Support
-----------------------------
=> Deutsche
=> Español
=> Français
=> Italiano
=> Português
=> 日本語
TinyPortal v1.0 beta 4 ©
Bloc
Loading...