[Javascript] Memory leaks?
Scott Reynen
scott at randomchaos.com
Sat Apr 22 09:22:48 CDT 2006
I have a few AJAX applications, which work fine in IE, Firefox, and
Safari, pinging the server every few seconds for new data. I've
noticed that if I leave one of these applications open overnight in
Safari (haven't tested this in anything else yet), the key event
handling will slow to a crawl by morning and it will only register
that I've typed something a second or two after I actually press the
key. When I first open the application, such typing will register
immediately. Even if I reload the page after this happens, it will
still be slow until I actually restart the whole browser.
I'm not clear on what's causing this, but it seems like a memory
leak. Here are two applications that both seem to cause this problem:
http://randomchaos.com/games/fastr/js/chat.js
http://randomchaos.com/games/fastr/js/group.js
The both involve typing in a text input, and they both take specific
actions on the return/enter (13) keypress. Unfortunately, you won't
be able to experience the problem yourself with registering and
leaving it open for several hours. I'm sure there are a hundred
problems with this code, as I'm largely self-taught in JavaScript.
I'm specifically interested in the problem I described above, and
would appreciate any suggestions in preventing such a gradual
slowdown of the event handling.
Peace,
Scott
More information about the Javascript
mailing list