| Page 1 of 1 | [ 2 posts ] |
|
When should destroy be called? Does it ever get called automatically by YUI lifecycle? Does the page unload cause the YUI lifecycle to call destroy on all objects created during the page processing? I have been working under the assumption that I need to make all my own calls to destroy but that gets hairy when ajax calls replace sections of code that I had progressively enhanced. I have written up my example in stackoverflow (When to call YUI destroy?) due to the size limitation here.
|
|
The answer by Tivac is basically correct. When the page unloads (i.e. you visit a new URL), all the memory for the page is cleaned up. Or it should be. Regardless, it stops being your concern whether the memory for a page remains allocated after the unload event has fired.
That said, if you're replacing content in the DOM dynamically in any way, you need to make sure to detach any event handlers you might have created on those parts of the DOM. Generally, pages aren't long-lived enough for this to be an issue unless you're attaching horrific numbers of event handlers. |
| Page 1 of 1 | [ 2 posts ] |
| You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum |
© 2006-2013 Yahoo! Inc. All rights reserved.
All code on this site is licensed under the BSD License unless stated otherwise.
About This Site · Security Contact Info
Powered by phpBB® Forum Software © phpBB Group