Note that there are some explanatory texts on larger screens.

plurals
  1. POFirefox specific memory increases in heavy AJAX app
    primarykey
    data
    text
    <p>I'm puzzled at why my app's memory increases so much faster in Firefox than other browsers.</p> <p>Basicially, the app uses a decent amount of AJAX, with the basic action being to load new sets of posts that have an average level of HTML, and generally have large images. The total avg data amount per post (incl loaded images) is under 1MB, maybe 900k. Using jQuery 1.7.1.</p> <p>In Chrome memory seems to be stable, but in Firefox, every post load results in about 20MB of new memory use. Since a lot of posts are loaded, you quickly get to over 1GB and even 1.4GB in memory, and things quickly grind to a halt. </p> <p>Digging in on Firefox, I tried to eliminate closures and any extraneous variables using 'delete'. No big improvement. I then started removing functionality, and it seemed like EVERYTHING makes a contribution. </p> <p>Removing ToolTips, some excessive re-loading of FB widgets (one comment widget per post), I made a big improvement, down to 10MB new memory per post.</p> <p>But beyond that, I can't get much lower! Basically, if I just load the new html + images (again about 900k ) via $.post() each post adds ~8mb of new memory, even if the new images have "display:none". (also tried disabling firebug).</p> <p>This is my first attempt at memory management, but this just seems like a lot of overhead, and odd since I don't think memory really increases like that in Chrome at all. Seems like I should get memory increases more in line with the amount of data loaded, not 10X! (or none at all like in Chrome would be nice...)</p> <p>Is this really reasonable? Any ideas on where to look for problems or what I can do to further minimize this problem? </p> <p>Thanks!</p> <p><strong>Update</strong>: </p> <p>As Boris aptly observed, the memory increase is almost entirely due to images (at least 80%). But again the memory increase is much more (10x) the size of the images loaded. One other thing I learned using about:memory - if I simply open up a new empty tab, the memory drops quickly and almost all the added image related memory disappears. I'm guessing that's GC kicking in, and thus as Boris guesses, it seems it's likely a GC issue? </p> <p>If that is the case, How might I investigate why it's not being triggered naturally only in FF? are there ways to trigger it in JS? As I mentioned, I tried to go through and remove closures... </p> <p>One other thought, could binding events (via jQuery) to image elements instead of divs be bad? I thought jQuery dealt with all that stuff though. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload