Re: addEventListener / attachEvent and passing 'this' to handler



On Jul 14, 5:32 am, Eric Bednarz <bedn...@xxxxxxxxxxxxxxxxxxx> wrote:
David Mark <dmark.cins...@xxxxxxxxx> writes:
On Jul 12, 8:08 am, Eric Bednarz <bedn...@xxxxxxxxxxxxxxxxxxx> wrote:
Using His Library for the same task, there appear to be no real leaks on
Windows 2000 (memory increases notably but is released when navigating
away from the test page). Well done.

LOL.  You mean My Library?

Yes, Your Library. ;-)

Doh! Kidding, of course. It wouldn't surprise me in the least if
*something* leaked in there with IE6. It would surprise me if it is
related to attachListener, so I was interested in your tests.


On XP SP2, on the other hand, every refresh leaks average 3 to 4 MiB
memory, with a peak of 8 MiB (refreshing ~ 20 times total).

I'd wager it is unrelated to my event code, which clearly does not
create circular references involving host objects.  I'd like to know
exactly what you tested and how you came to your conclusions.

I knew my test was probably problematic itself, but I used the same one
for three different IE 6 environments, so that was not my primary
concern.

You may be on to something. Just not sure what yet.


What I did was creating a DIV element, appending it to the DOM,
appending a text node and attaching a click event. In that order, in a
loop with 500 iterations, on the window’s load event.

Okay.


Not generating the elements client side made things better (rather
unsurpsisingly).

Well, I find that a bit odd. Did the library play any part in
creating these nodes?


And I used the complete library. I already suspected that this would
matter, too. Kangax recently posted the basic event code and I used that
for an absolute minimum test (correcting the minor error he made). With
this setup, I noticed a much smaller but consistent memory leakage.

The complete library is not going to be a good test case for this. I
was going to suggest the code posted by Kangax.


After some random testing the ugly truth dawned upon me. It is much
worse than I thought. I through all of the test code out and generated
a javascript file with 500 function declarations that just return
false. No function calls, no DOM access, nothing. Using that ~ 18KiB
file, IE6 was consistently leaking ~200KiB on every (re)load of the
page. Unsurprisingly, in further testing this leakage grew with the file
size (hence the obscene amount when using the complete mylib.js).

Yes, I suspected IE6 and XP were to blame. Sounds like the bigger the
script (whatever it holds), the bigger the leak. Pretty bad when MS
can't write a competent browser for their own OS.


The offending system is XP SP2.

Should be locked up. :)


I’ll put a test case for that online tomorrow or so, today is some sort
of anniversary to attend to :-)

I guess I'm slightly less interested now, but it would be nice to
document this particular abomination.

I think I've said it here before, but I would never buy a PC with
Windows installed on it again. I can't believe it took me over a
decade to realize that Microsoft was all marketing.
.



Relevant Pages

  • Re: IE6 memory problems and extra Dlls
    ... Process Explorer from SystemInternals would certainly tell you that. ... Process Explorer for Windows: ... into memory several DLL's, which are related to our AV product. ... launch of IE6. ...
    (microsoft.public.windowsxp.help_and_support)
  • Re: IE6 memory problems and extra Dlls
    ... Process Explorer will show up each instance of IE6 which is open. ... Process Explorer for Windows: ... into memory several DLL's, which are related to our AV product. ...
    (microsoft.public.windowsxp.help_and_support)
  • RE: Virtual memory
    ... You can configure virtual memory in windows xp and thereby improve the ... How to set performance options in Windows XP ... if you have background programs such as printing or disk ... It is also known as the paging file. ...
    (microsoft.public.windowsxp.perform_maintain)
  • [NT] NNTP Service in Windows Contains Memory Leak
    ... NNTP Service in Windows Contains Memory Leak ... An affected server could be restored to normal service by ...
    (Securiteam)
  • Re: Physical Memory
    ... These Windows services are started: ... Memory optimizers/defragers are nothing more than snake ... These optimizers work by making demands on the Windows Memory Manager ... The funny thing about all of this nonsense is that the snake oil memory ...
    (microsoft.public.windowsxp.general)