Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #32542
| Newsgroups | comp.lang.javascript |
|---|---|
| Subject | Re: removeEventListener why |
| From | "Evertjan." <exxjxw.hannivoort@inter.nl.net> |
| References | <hbCdnUYE2rVRhQTFnZ2dnUU7-dvNnZ2d@westnet.com.au> <o7bjl9$rir$1@dont-email.me> <XnsA71576F20B91eejj99@194.109.6.166> <9c965d2d-c98d-4b7e-94e5-988e4fa4bdc8@googlegroups.com> |
| Date | 2017-02-07 12:44 +0100 |
| Message-ID | <XnsA715819EAB0E6eejj99@194.109.6.166> (permalink) |
Julio Di Egidio <julio@diegidio.name> wrote on 07 Feb 2017 in comp.lang.javascript: > On Tuesday, February 7, 2017 at 11:41:34 AM UTC+1, Evertjan. wrote: >> "Julio P. Di Egidio" <julio@diegidio.name> wrote on 07 Feb 2017 in >> comp.lang.javascript: >> >> > "Andrew Poulos" wrote in message >> > news:hbCdnUYE2rVRhQTFnZ2dnUU7-dvNnZ2d@westnet.com.au... >> >> >> >> If I use addEventListener on an element in the page should I then >> >> use removeEventListener before the page is unloaded? >> >> >> >> Is it good practice to remove all listeners I add or does it make no >> >> difference? I'm usually careful about removing all listeners I add >> >> but I don't know if today it serves any real purpose. >> >> >> >> In the past I used to be worried about memory leaks. Is it still an >> >> issue? >> > >> > Yes, you should destroy all event handlers before the page is >> > unloaded, browsers may, and AFAICT still do, leak memory otherwise. >> > There was an article explaining the details which I cannot find now: >> > it was about orphaned references not getting automatically >> > released... or something along that line. >> >> No, you should not. > > A professional programmer definitely should. This is nonsense. As a professional programmer, I should not go on hearsay, but go for facts and numbers. Do you have facts to which browsers are so disfunctional, and how much memory is lost for each leaking listener in such browser? Would it take 10 minutes, 10 years or 1000 years for such a defunctional browser regularily accessing such web-pages to loose an important part of its memory-pool? >> Any 'page' has so many listenters by default > > And you should rightly expect that *those* are automatically released. Again, just hearsay, why are you so trusting here? > As I have hinted at above, there are reasons why to today browsers > cannot do better than that, i.e. cannot do better than leave the > programmer to care for his or her own code. Oh yes, what are those reasons? Please elaborate. > That may be unfortunate, I do not really disagree, but in order to write > pages that do not leak it is a matter of fact that one *has to* destroy > event-related resources explicitly. How do you know? I don't say you don't know, but you should elaborate instead of having us [sorry: me] believe you you at unseeen face-value. > Note that this is not just about > preventing the browser overall from licking, so a matter of overall user > experience, Why? The only limiting factor in user-experience would be craching due to memory pool loss. So please elaborate. > which you might even make a point not to care about, it is > also about writing heavily scripted groups of apps and pages and > similar, i.e. sometimes not caring is not even an option, depending on > the complexity of an application. Ah, authority experience. PS: I did not say above I was a professional programmer, nor that I was not. -- Evertjan. The Netherlands. (Please change the x'es to dots in my emailaddress)
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
removeEventListener why Andrew Poulos <ap_prog@hotmail.com> - 2017-02-07 11:46 +1100
Re: removeEventListener why "Julio P. Di Egidio" <julio@diegidio.name> - 2017-02-07 05:51 +0100
Re: removeEventListener why "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-02-07 11:41 +0100
Re: removeEventListener why Julio Di Egidio <julio@diegidio.name> - 2017-02-07 03:00 -0800
Re: removeEventListener why "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-02-07 12:44 +0100
Re: removeEventListener why JJ <jj4public@vfemail.net> - 2017-02-07 22:50 +0700
Re: removeEventListener why "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-02-07 18:17 +0100
Re: removeEventListener why JJ <jj4public@vfemail.net> - 2017-02-08 23:11 +0700
Re: removeEventListener why "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-02-08 19:39 +0100
Re: removeEventListener why Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-02-09 02:02 +0100
Re: removeEventListener why Julio Di Egidio <julio@diegidio.name> - 2017-02-08 20:33 -0800
Re: removeEventListener why "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-02-09 11:51 +0100
Re: removeEventListener why Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-02-09 12:01 +0100
Re: removeEventListener why JJ <jj4public@vfemail.net> - 2017-02-09 18:36 +0700
Re: removeEventListener why Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-02-09 13:09 +0100
Re: removeEventListener why "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2017-02-07 06:32 -0800
Re: removeEventListener why Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-02-07 17:31 +0100
Re: removeEventListener why Julio Di Egidio <julio@diegidio.name> - 2017-02-07 11:59 -0800
Re: removeEventListener why Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-02-07 21:55 +0100
Re: removeEventListener why Julio Di Egidio <julio@diegidio.name> - 2017-02-07 13:23 -0800
Re: removeEventListener why "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2017-02-08 06:03 -0800
Re: removeEventListener why "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2017-02-08 05:54 -0800
csiph-web