javascript - firefox memory leak -
i have following script (i use raphaeljs also) draws circle, waits 1 second, draws circle again, etc (you can copy paste - functional, need include raphael raphaeljs.com):
<div id="holder"> </div> <script src="raphael.js" type="text/javascript"></script> <script> var paper = raphael(10, 50, 320, 200); var rad = math.pi / 180; var finangle = 0; function sector(cx, cy, r, startangle, endangle, params) { var x1 = cx + r * math.cos(-startangle * rad), x2 = cx + r * math.cos(-endangle * rad), y1 = cy + r * math.sin(-startangle * rad), y2 = cy + r * math.sin(-endangle * rad); return ["m", cx, cy, "l", x1, y1, "a", r, r, 0, +(endangle - startangle > 180), 0, x2, y2]; } var path = sector(100,100,50,0,180); var arc = paper.path(path); function draw() { path = sector(100,100,50,0,finangle); arc.attr({"path": path}); finangle += 1; /* if (finangle == 360) finangle = 359; */ if (finangle > 360) { clearinterval(interval); settimeout("setnewinterval();", 1000); finangle = 1; } return; } function setnewinterval() { interval = setinterval("draw();", 3); } var interval = setinterval("draw();", 3); </script>
the problem seem generate memory leak on firefox (i let run 10 min , firfox got 700mb of ram (chrome stayed @ 25mb)). chrome has no problems it.
any ideas how fix that?
looks sort of odd gc heuristic issue. filed https://bugzilla.mozilla.org/show_bug.cgi?id=761893
in meantime, best can find what's allocating tens of megabytes of strings per second , not doing that...
Comments
Post a Comment