Meaningless Drivel is fun!*
The moose likes HTML, CSS and JavaScript and the fly likes Prototype Event Handlers & IE Memory Leaks Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Prototype Event Handlers & IE Memory Leaks" Watch "Prototype Event Handlers & IE Memory Leaks" New topic
Author

Prototype Event Handlers & IE Memory Leaks

Scott Escue
Ranch Hand

Joined: Jan 20, 2005
Posts: 34
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

Joined: Jan 10, 2002
Posts: 60782
    
  65

I read somewhere, though I cannot find it on short notice, that Prototype automatically calls unloadCache in IE on your behalf.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Scott Escue
Ranch Hand

Joined: Jan 20, 2005
Posts: 34
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

Joined: Jan 10, 2002
Posts: 60782
    
  65

No problem, now it's also posted here for everyone else's knowledge. Good job!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Prototype Event Handlers & IE Memory Leaks
 
Similar Threads
how to get the object which user clicked
form field's value from a string
Head First Servlets: Beer Problem
String Object query
how to make dynamic combo box