jQuery: The Write Less, Do More JavaScript Library

Ticket #225 (closed bug: fixed)

Opened 2 years ago

Last modified 1 year ago

[PATCH] IE Memory Leaks from event system

Reported by: brandon.aaron@… Assigned to: anonymous
Type: bug Priority: critical
Milestone: Component: event
Version: Keywords:
Cc: brandon.aaron@gmail.com Needs:

Description

Currently jQuery does not take care of the well known memory leak from adding but not removing event handlers in IE. This is a patch to add this in.

The diff: http://brandonaaron.net/jquery/memoryleak/event_leak_fix.diff The example without the fix: http://brandonaaron.net/jquery/memoryleak/event_leak.html The example with the fix: http://brandonaaron.net/jquery/memoryleak/event_leak_fix.html The blog entry: http://brandonaaron.net/articles/2006/09/30/fixing-jquerys-memory-leak

Attachments

Change History

Changed 2 years ago by joern

  • status changed from new to closed
  • resolution set to fixed

Added to SVN. Good job Brandon!

Changed 2 years ago by danyalex

The hotfix removes the custom unload events also. It's better to check if type == 'unload' before removing the event.

Changed 2 years ago by brandon.aaron@…

  • status changed from closed to reopened
  • resolution deleted

danyalex is correct. Here is an updated patch and example.

The example (you should get an alert onunload): http://brandonaaron.net/jquery/memoryleak2/event_leak_fix.html The diff: http://brandonaaron.net/jquery/memoryleak2/event_leak_fix.diff

Also this patch fixes a memory leak in Firefox related to the ready event. You can verify using the leak monitor extension vs this unfixed page: http://brandonaaron.net/jquery/memoryleak2/event_leak.html

Changed 2 years ago by joern

  • status changed from reopened to closed
  • resolution set to fixed

I added it to SVN. Just reopen this ticket if there are other issues...

Note: See TracTickets for help on using tickets.