XmlHttpRequest not working

Tags: .NET, AJAX, IE

The last weeks I done a lot of test because of the memory leaks using .innerHTML or events (closures). When building some test pages I ran into a problem. I reached 65.000 handles for iexplore.exe. From time to time I got a dialog box asking if I want to send data to a different location (the same question you get if you post data to a different domain). I clicked on yes, I clicked on no - both buttons are working, and my AJAX method, too. But some requests later I got the dialog box again, ...and again.

If you have a look at http://www.start.com/ or http://www.live.com/ you will see that the memory and the number of handles used in iexplore.exe is increasing on a lot of features you use, like minimizing or moving controls, adding new gadgets,...

If you press F5 (reload) the handle count will not decrease to an initial value. Another test showed me that an empty HTML page can increase the number of handles used on every page refresh, it was about 2 handles per page. This means that you can only open this page about 32.500 times.   ;)

I will put an demo web page online during the next days.

2 Comments

  • Dave Tigweld said

    My purchasing application has been doing AJAX (without the xmlhttp object for years). We learned early on that we were in trouble with innerHTML. Not only can it leak but is also prone to causing a browser crash (especially IE 5.x).

    I recommend a model where you actually change outerHTML instead. Its been very stable and no leaks. Firefox doesn't of course support outerHTML so you'll need a javascript function to disassemble your OuterHTML for it.

    Since you are concerned about leaks I should also warn you about IE behaviors. These guys are the devil when it comes to leaks. Think about a grid where you may have a behavior on a particular cell. If you rewrite the grid, your going to leak that memory like a sieve. Your not going to get it back until the user actually closes the browser - a refresh won't cut it. We took the time some years ago to completely eliminate behaviors.

    Good Luck

Comments have been disabled for this content.