Opened 12 years ago

Closed 6 years ago

Last modified 6 years ago

#2319 closed defect (fixed)

memory leak in ScriptSrcTransport

Reported by: yh_mailinglist@… Owned by: Bryan Forbes
Priority: high Milestone: 1.8
Component: IO Version: 0.4.1
Keywords: needsreview Cc:
Blocked By: Blocking:

Description (last modified by James Burke)

Hi dojo team,

I have found a memory leak problem using ScriptSrcTransport? the problem happens with ie6, ff1.5, ff2.0 and opera 9 on win2000

I use dojo 0.4.1rc3

I have attached a small example to reproduce it. The example works only with ff

To reproduce the pb:

  1. copy the example in tests/io
  2. open the page (it should display hello with a counter)
  3. open the task manager, and see the memory consumption growing

This is an important issue for me because I use such periodic polling to simulate server push. I hope you'll find where the pb is.

Thanks

Yann

Attachments (2)

bindtest3.html (1.3 KB) - added by yh_mailinglist@… 12 years ago.
bindResp3.js (30 bytes) - added by yh_mailinglist@… 12 years ago.

Download all attachments as: .zip

Change History (13)

Changed 12 years ago by yh_mailinglist@…

Attachment: bindtest3.html added

Changed 12 years ago by yh_mailinglist@…

Attachment: bindResp3.js added

comment:1 Changed 12 years ago by James Burke

Component: GeneralIO
Description: modified (diff)
Milestone: 0.9
Owner: changed from anonymous to James Burke

Since it is a consistent memory growth across browsers, my first thought is it is just the cost of adding so many script tags to the DOM. I think the browsers are not cleaning up resources related to adding the script tags. Not sure if we can do much about it.

You can try calling dojo.io.ScriptSrcTransport?.removeScripts() to see if that helps. dojo.io.ScriptSrcTransport? does not call it automatically because of issues with MSIE.

API info: http://dojotoolkit.org/api/#dojo.io.ScriptSrcTransport.removeScripts

Also, adding a script tag every 10 ms is a bit extreme. I tried a longer interval, and things were better, but there does seem to be a gradual increase in memory over time, at least in FF 2.0 on OSX.

I verified that the internal dojo.io.ScriptSrcTransport?._state object is cleaned up, so at least it is not that object that is requiring more and more memory.

I am likely to close it as a wontfix because I'm not sure there is anything we can do about it. I would imagine any implementation of dynamic script tags suffers the same issue. I'll leave it open for a little bit to see if any new info becomes available and target the next release after 0.4.2 for this bug.

comment:2 Changed 12 years ago by James Burke

I just checked this page that uses dynamic script tags and polling to show the user's buddy list: http://developer.aim.com/webaim

Click on the See our default AIM Whimsicals theme in action!" link to start the buddy list (you just have an AIM or AOL account to try it).

That page does not use Dojo but it has a similar issue of gradually increasing memory over time. It leads me more to believe in a general issue with adding lots of script tags over time.

comment:3 Changed 12 years ago by James Burke

(In [9962]) Refs #2319. Remove script elements in the jsonp style of usage that have already succeeded. This is not the fix though, and not sure if there will be a complete one without engaging browser vendors. Even in a test I did before without using dojo, just simple script attachments and removal of nodes when it was done, I saw a few bytes leaked on each call (I think the amount depends on the size of the response in the script).

comment:4 Changed 12 years ago by James Burke

Milestone: 0.91.0

Moving to 1.0. I suspect we need browser vendor help closing down the last bit of leakage, but I think this is as good as we can do for 0.9 -- at least it should be no worse than 0.4.x.

comment:5 Changed 12 years ago by James Burke

Milestone: 1.01.1

Not a 1.0 blocker, need to register bug cases with browser vendors.

comment:6 Changed 11 years ago by James Burke

Milestone: 1.11.2

comment:7 Changed 11 years ago by James Burke

Description: modified (diff)
Milestone: 1.2future

comment:8 Changed 7 years ago by ben hockey

Keywords: needsreview added

comment:9 Changed 7 years ago by bill

Owner: changed from James Burke to Bryan Forbes

Bulk change to reassign IO tickets to Bryan, since he is working on new dojo/request module. Some of these tickets should probably be closed as already fixed, invalid, or wontfix.

comment:10 Changed 6 years ago by dylan

Resolution: fixed
Status: newclosed

This was completely rewritten with dojo/request, so closing this out.

comment:11 Changed 6 years ago by bill

Milestone: future1.8
Note: See TracTickets for help on using tickets.