Yes, the garbage collection is still there in 1.2, it's just not available
for you to access.
Ognen, if your app is open for a long period and you are adding new things
and removing others, you should use the .destroy method on the elements you
are retiring to remove them from the document. You can also collect things
by using .set('html', newHTMLhere), which destroys the content of the
container element before writing in the new html. Element.empty() does the
same thing (destroying all children).On Fri, Apr 3, 2009 at 3:26 AM, gabriel munteanu (via Nabble) < [email protected]<ml-user%[email protected]> > wrote: > > yes, i did, long time ago - in a far far galaxy :) . > there is a special class in mootools 1.1 [Garbage/Trash or something] > that fires upon onBeforeUnloading event. > in the cleanup method of that garbage collector, it ran through all > objects created, and collected them away. > well i limited that cycle to 100 or so - very bad , i know. > for the rest of the objects i was hoping the browser GC itself will > do the dirty job, when the user would not notice in a background > thread or something. > doing GC in mootools is possible only in the main thread, that is why > the unresponsive closing of the window. > > in 1.2, that class disapeared, it could have been replaced by > something else, didn't digg deep enough on this one. > i know they state in the doc, at Element.destroy , that GC occurs upon > destroy call, so you can do some GC yourself, as new objcts come in, > and old objects will never get used again in the future. > > jgabios - gamer > http://www.e-forum.ro/bomberman/dynagame.html > > > On Fri, Apr 3, 2009 at 12:55 PM, electronbender > <ognen.plavev...@...<http://n2.nabble.com/user/SendEmail.jtp?type=node&node=2579879&i=0>> > wrote: > > > > Yes, but in this case i'm still using moo 1.1, so i dont know if that > > applies there. > > And when it comes to the garbage collection, i'm experiencing > > something strange, which i presume is garbage cleenup: > > I have mootools on top of google maps, where i update the data every 5 > > minutes. If you let the app run for +20 minutes, and try to close the > > window, you get a non responsive javascript window. > > As far as i can tell there is no extensive calculation on my end, so > > i'm presuming this is with the cleanup. > > Has anyone experienced this? > > > > On Apr 2, 8:56 pm, nutron > > <anut...@...<http://n2.nabble.com/user/SendEmail.jtp?type=node&node=2579879&i=1>> > wrote: > >> Using MooTools this is something you don't have to worry about so much > these > >> days. It has its own garbage collection mechanisms. The important thing > is > >> that you always use the MooTools methods for selecting elements: $, $$, > >> element.getElements, etc. But never document.getElementById, > >> document.getElementByClassName. If you use those methods, you must wrap > >> their results in $ and $$. > >> So long as your elements are collected through mootools (or passed > through > >> $), they will be extended by MooTools and then garbage collected by > >> MooTools. > >> > >> On Thu, Apr 2, 2009 at 5:08 AM, electronbender (via Nabble) < > >> ml-user+55942-1381446...@...<http://n2.nabble.com/user/SendEmail.jtp?type=node&node=2579879&i=2> > <ml-user%2b55942-1381446...@...<http://n2.nabble.com/user/SendEmail.jtp?type=node&node=2579879&i=3>> > > >> > >> > >> > >> > wrote: > >> > >> > I was just reading an article by Aaron about memory leaks, and > >> > although he does say what is bad he does not say what is good. > >> > So from the example this is bad: > >> > function sayHi(observeId, message) { > >> > var el = $(observeId); > >> > Event.observe(el, "click", function() { > >> > alert(message); > >> > }); > >> > } > >> > >> > But what is good? > >> > Is this: > >> > function sayHi(observeId, message) { > >> > Event.observe($(observeId), "click", function() { > >> > alert(message); > >> > }); > >> > } > >> > >> > Also, which of these 2 is good and which is bad: > >> > var someEl = new Element('div',{'id':'someEl'}) > >> > someEl.addEvent('click',function(){ > >> > alert('bla') > >> > }) > >> > someEl.injectInside($(somediv)) > >> > >> > Or this: > >> > var someEl = new Element('div',{'id':'someEl'}) > >> > someEl.injectInside($(somediv)) > >> > >> > $('someEl').addEvent('click',function(){ > >> > alert('bla') > >> > }) > >> > >> > ------------------------------ > >> > View message @ > >> >http://n2.nabble.com/-Moo--Memory-leaks-tp2574784p2574784.html > >> > To start a new topic under MooTools Users, email > >> > ml-node+660466-1583815...@...<http://n2.nabble.com/user/SendEmail.jtp?type=node&node=2579879&i=4> > <ml-node%2b660466-1583815...@...<http://n2.nabble.com/user/SendEmail.jtp?type=node&node=2579879&i=5>> > > >> > To unsubscribe from MooTools Users, click here< (link removed) >. > >> > >> ----- > >> The MooTools Tutorial: http://www.mootorial.comwww.mootorial.com > >> Clientcide: http://www.clientcide.comwww.clientcide.com > >> -- > >> View this message in context: > http://n2.nabble.com/-Moo--Memory-leaks-tp2574784p2576981.html > >> Sent from the MooTools Users mailing list archive at Nabble.com. > > > ------------------------------ > View message @ > http://n2.nabble.com/-Moo--Memory-leaks-tp2574784p2579879.html > To start a new topic under MooTools Users, email > [email protected]<ml-node%[email protected]> > To unsubscribe from MooTools Users, click here< (link removed) >. > > > ----- The MooTools Tutorial: http://www.mootorial.com www.mootorial.com Clientcide: http://www.clientcide.com www.clientcide.com -- View this message in context: http://n2.nabble.com/-Moo--Memory-leaks-tp2574784p2581386.html Sent from the MooTools Users mailing list archive at Nabble.com.
