Hi Guys I''m cleaning up the many many memory leaks in this application i''ve been working on. Do I still need a reference to the event observer functions to destroy them? I.e.: Event.stopObserving(element,''click'', ??); or element.stopObserving(''click''); Event.stopObserving(element,''click''); If there''s more than one click event, this is fine as i''m going to be removing the element following this anyway. Perhaps we need an article on prototype memory management? Is the stopobserving article out of date on the api? Christophe''s book suggested I didn''t need to pass the function handler. Gareth --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
You don''t need to pass the handler; Event.stopObserving(element) will remove all handlers for the element, and Event.stopObserving(element, ''click'') will remove all click handlers. (Correct me if I''m wrong, but that''s what I remember from my code-reading adventures on the train.) -Fred On Thu, Jun 19, 2008 at 5:48 PM, Gareth Evans <agrath-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi Guys > > I''m cleaning up the many many memory leaks in this application i''ve been > working on. > Do I still need a reference to the event observer functions to destroy > them? > I.e.: > > Event.stopObserving(element,''click'', ??); > or > element.stopObserving(''click''); > Event.stopObserving(element,''click''); > > If there''s more than one click event, this is fine as i''m going to be > removing the element following this anyway. >-- Science answers questions; philosophy questions answers. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Moreover, the trunk version actually augments Element#update (in IE) to "purge" observers automagically : ) That was actually one of the nasty leaks being constantly reported. - kangax On Jun 20, 10:37 am, "Frederick Polgardy" <f...-SMQUYeM9IBBWk0Htik3J/w@public.gmane.org> wrote:> You don''t need to pass the handler; Event.stopObserving(element) will remove > all handlers for the element, and Event.stopObserving(element, ''click'') will > remove all click handlers. (Correct me if I''m wrong, but that''s what I > remember from my code-reading adventures on the train.) > > -Fred > > > > On Thu, Jun 19, 2008 at 5:48 PM, Gareth Evans <agr...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Hi Guys > > > I''m cleaning up the many many memory leaks in this application i''ve been > > working on. > > Do I still need a reference to the event observer functions to destroy > > them? > > I.e.: > > > Event.stopObserving(element,''click'', ??); > > or > > element.stopObserving(''click''); > > Event.stopObserving(element,''click''); > > > If there''s more than one click event, this is fine as i''m going to be > > removing the element following this anyway. > > -- > Science answers questions; philosophy questions answers.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
*That''s* a nice feature! On Fri, Jun 20, 2008 at 10:16 AM, kangax <kangax-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Moreover, the trunk version actually augments Element#update (in IE) > to "purge" observers automagically : )-- Science answers questions; philosophy questions answers. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
And Element#remove? On Sat, Jun 21, 2008 at 3:16 AM, kangax <kangax-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Moreover, the trunk version actually augments Element#update (in IE) > to "purge" observers automagically : ) > That was actually one of the nasty leaks being constantly reported. > > - kangax > > On Jun 20, 10:37 am, "Frederick Polgardy" <f...-SMQUYeM9IBBWk0Htik3J/w@public.gmane.org> wrote: > > You don''t need to pass the handler; Event.stopObserving(element) will > remove > > all handlers for the element, and Event.stopObserving(element, ''click'') > will > > remove all click handlers. (Correct me if I''m wrong, but that''s what I > > remember from my code-reading adventures on the train.) > > > > -Fred > > > > > > > > On Thu, Jun 19, 2008 at 5:48 PM, Gareth Evans <agr...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Hi Guys > > > > > I''m cleaning up the many many memory leaks in this application i''ve > been > > > working on. > > > Do I still need a reference to the event observer functions to destroy > > > them? > > > I.e.: > > > > > Event.stopObserving(element,''click'', ??); > > > or > > > element.stopObserving(''click''); > > > Event.stopObserving(element,''click''); > > > > > If there''s more than one click event, this is fine as i''m going to be > > > removing the element following this anyway. > > > > -- > > Science answers questions; philosophy questions answers. > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
On Jun 21, 3:04 am, "Gareth Evans" <agr...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> And Element#remove?Same question ... when I remove an element, all event handlers linked (created by element#observe) to this element should be removed automagically or not ? Or I should call element#stopObserving before each element#remove ? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
mocambo, at the moment, update/remove don''t remove observers. The core team is working on this functionality. For now, you need to call stopobserving. On Mon, Jun 23, 2008 at 12:40 PM, mocambo <mocambo-S7FoVGKkKTI@public.gmane.org> wrote:> > On Jun 21, 3:04 am, "Gareth Evans" <agr...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > And Element#remove? > > Same question ... when I remove an element, all event handlers linked > (created by element#observe) to this element should be removed > automagically or not ? > > Or I should call element#stopObserving before each element#remove ? > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Good to know, thanks ! On Jun 23, 3:41 am, "Gareth Evans" <agr...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> mocambo, at the moment, update/remove don''t remove observers. The core team > is working on this functionality. > For now, you need to call stopobserving. > > On Mon, Jun 23, 2008 at 12:40 PM, mocambo <moca...-S7FoVGKkKTI@public.gmane.org> wrote: > > > On Jun 21, 3:04 am, "Gareth Evans" <agr...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > And Element#remove? > > > Same question ... when I remove an element, all event handlers linked > > (created by element#observe) to this element should be removed > > automagically or not ? > > > Or I should call element#stopObserving before each element#remove ?--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---