Bug Tracker

Ticket #3163 (new enhancement)

Opened 4 months ago

Last modified 3 months ago

IE pseudo-leak

Reported by: henric Assigned to: anonymous
Type: enhancement Priority: trivial
Milestone: 1.3 Component: ajax
Version: 1.2.6 Keywords: memory leak
Cc: Needs: Test Case

Description

sIEve reports DOM leaks for AJAX stuff. In the particular case I was debugging, with a .load() every few seconds replacing the contents of a <div>, unless things are attached to the root document in some way when "freed", they will apparently not be reclaimed until the page is reloaded. IE's memory usage, as seen in Task Manager, reports the same thing (after a few hours, IE will crash).

I pilfered and integrated a fix that seems to resolve this particular problem for me, but as this constitutes my first toe-in-the-water with JavaScript (more like head first into a pool w/o water), I am more than a little wary of unintentional side-effects this change may cause. The extra code should probably be conditional on browser.msie and could possibly be made more efficient (do the innerHtml thing on batches of objects)--and that's assuming that it is the right thing to do in the first place (for IE anyway).

I've seen "discardElement" and similar code in a number of place; I don't recall where I originally got it. I also suspect that the jQuery folks have seen similar code but have chosen not to use it.

I've attached a patch from 1.2.6 to what I'm running. It does seem to solve my problem; I make no further claims...

Attachments

jquery-iefix.diff (1.7 kB) - added by henric 4 months ago.
patch against 1.2.6
test1000.html (0.5 kB) - added by henric 3 months ago.
Variant of documentation's html API example

Change History

Changed 4 months ago by henric

patch against 1.2.6

follow-up: ↓ 2   Changed 4 months ago by flesler

  • component changed from core to ajax
  • priority changed from major to trivial
  • owner deleted
  • milestone set to 1.3
  • need changed from Review to Test Case
  • type changed from bug to enhancement

Can you provide a concise test case to reproduce the leak ?

Changed 3 months ago by henric

Variant of documentation's html API example

in reply to: ↑ 1 ; follow-up: ↓ 3   Changed 3 months ago by henric

Replying to flesler:

Can you provide a concise test case to reproduce the leak ?

In the attached "test1000.html," I've added a for loop to the documentation's html(val) example. The "fixed" version reports 12017 DOM nodes in use (and ~62MB of RAM). Using 1.2.6 reports 19017 DOM nodes in use (~102MB of RAM).

Ideally, the DOM usage should be the same regardless of the constant in the for loop.

Oh, I'm on Vista Ultimate x64 using sIEve-0.8.0.

in reply to: ↑ 2   Changed 3 months ago by henric

Replying to henric:

Replying to flesler:

Can you provide a concise test case to reproduce the leak ?

In the attached "test1000.html," I've added a for loop to the documentation's html(val) example. The "fixed" version reports 12017 DOM nodes in use (and ~62MB of RAM). Using 1.2.6 reports 19017 DOM nodes in use (~102MB of RAM). Ideally, the DOM usage should be the same regardless of the constant in the for loop. Oh, I'm on Vista Ultimate x64 using sIEve-0.8.0.

Errrr... that should read: sIEve-0.0.8

(And Vista has SP1.)

Note: See TracTickets for help on using tickets.