Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Prototype Event Handlers & IE Memory Leaks

 
Scott Escue
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I recently did some work on the browser side where I made use of javascript event handlers. Prototype's observe functions made registering event handlers across browser implementations a non-issue. However, before being introduced to Prototype I did some research on javascript event handling and I came across mention of event handler memory leaks in IE. (Bret Taylor from ajaxcookbook.org references this problem description) Prototype allowed me to scrap the cross-browser event handling library I was working on, but I haven't been able to find out if Prototype addresses these memory leaks in IE. I had thought that maybe prototype unregisters the event handlers behind the scenes, but when I was browsing the Prototype API the other day I came across the Event.unloadCache function which unregisters all event handlers added using observe. So now I'm wondering if I should be calling unloadCache myself on page unload to avoid IE's memory leaks. I've tried to find an answer to this in the Prototype documentation but so far no luck. Since there are several gurus floating around the forum this week I'm hoping someone may have some insight.

[ April 10, 2007: Message edited by: Scott Escue ]
[ April 10, 2007: Message edited by: Scott Escue ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64613
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I read somewhere, though I cannot find it on short notice, that Prototype automatically calls unloadCache in IE on your behalf.
 
Scott Escue
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
http://www.prototypejs.org/api/event/unloadCache
Prototype automatically hooks unloadCache to page unloading, exclusively for MSIE. So you don�t have anything to do. It�s all taken care of.


doh... It's right there in the API I should've clicked on a few more links before posting.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64613
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No problem, now it's also posted here for everyone else's knowledge. Good job!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic