JSONP Ajax Call with JQuery causes memory leak -
i searched complete day , cannot find issue why such big memory leaks in phonegap application, uses lot of ajax-jsonp requests server.
therefore broke down simplest example. can find here on jsfiddle.
the main content of is:
function run(){ $.ajax({ datatype: 'jsonp', url: "http://thawing-bayou-7281.herokuapp.com/test.js", success: function (res) { // stuff here settimeout(run, 250); } }); }; run();
so code calls jsonp api request endless time every 250ms.
please note: know example never implement that! it's detecting memory leak.
when run example used memory increases rapidly (you can see best in chromes timeline tab). number of dom nodes increasing rapidly. @ point breaks down (maybe gc?) elements , needed memory increases rapidly.
has of idea how fix problem?
thanks!
this not memory leak, sawtooth type graphs common in java. memory usage ramps up, garbage collector gets called, , drops down. graph showed represents such situation.
you have memory leak if low points of graph continually increased, not being shown in graph.
Comments
Post a Comment