Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #32526

Re: removeEventListener why

Path csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From "Julio P. Di Egidio" <julio@diegidio.name>
Newsgroups comp.lang.javascript
Subject Re: removeEventListener why
Date Tue, 7 Feb 2017 05:51:20 +0100
Organization A noiseless patient Spider
Lines 1
Message-ID <o7bjl9$rir$1@dont-email.me> (permalink)
References <hbCdnUYE2rVRhQTFnZ2dnUU7-dvNnZ2d@westnet.com.au>
Mime-Version 1.0
Content-Type text/plain; format=flowed; charset="UTF-8"; reply-type=response
Content-Transfer-Encoding 7bit
Injection-Date Tue, 7 Feb 2017 04:49:45 -0000 (UTC)
Injection-Info mx02.eternal-september.org; posting-host="1c2715a88b56e96fd2e61ad2b5361d25"; logging-data="28251"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18+WlxUGlWnp1zsYXAZZoMZJz8tFFccFZ4="
X-MimeOLE Produced By Microsoft MimeOLE V16.4.3528.331
In-Reply-To <hbCdnUYE2rVRhQTFnZ2dnUU7-dvNnZ2d@westnet.com.au>
X-Newsreader Microsoft Windows Live Mail 16.4.3528.331
Importance Normal
Cancel-Lock sha1:44haPj/07HyVDk2iDysbfo0ZDFE=
X-Priority 3
X-MSMail-Priority Normal
Xref csiph.com comp.lang.javascript:32526

Show key headers only | View raw


"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.

HTH,

Julio

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


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