unloadCache
1.6
Event.unloadCache()
Unregisters all event handlers registered through observe
. Automatically wired for you. Not available since 1.6.
This method is removed in the 1.6 release. Remove calls to it from any script you currently use.
The sad tale of MSIE, event handlers and memory leaks
There is a significant issue with MSIE, which is that under a variety of conditions, it just will not release event handlers when the page unloads. These handlers will stay in RAM, filling it up slowly, clogging the browser’s arteries. This is known as a memory leak.
Of course, manually keeping tabs on all the handlers you register (which you do through observe
, being such a nice person) is pretty tedious. And boring. It would be, in short, the essence of un-cool.
Which is why Prototype takes care of it for you. It keeps tabs, and when unloadCache
is called, it unregisters everything and frees references, which is akin to sending a big pink lavender-perfumed invitation to the garbage collector.
You don’t even need to know this
What’s even better is, Prototype automatically hooks unloadCache
to page unloading, exclusively for MSIE. So you don’t have anything to do. It’s all taken care of. We just though you’d like to know. Go do something productive, some value-added JavaScript code for instance. We’re not here to hinder you with automatable details.