Skip to main content

Bug Tracker

Side navigation

#10044 closed bug (duplicate)

Opened August 14, 2011 12:02AM UTC

Closed August 18, 2011 05:15PM UTC

Last modified March 14, 2012 08:38AM UTC

jquery - ajax with memory leak

Reported by: roberto@spadim.com.br Owned by: roberto@spadim.com.br
Priority: low Milestone: None
Component: ajax Version: 1.6.1
Keywords: Cc:
Blocked by: Blocking:
Description

hi guys i'm running a simple 'refresh' with ajax and i'm getting a memory grow without understanding why

check if i'm wrong or if i'm doing a wrong memory clean

running in firefox and i.e. i get a memory growing

running on google chrome don't :/

i'm using jquery 1.6.1 and php script that return a blank page when ?frame=1

the javascript execute a ajax that return a blank page (?frame=1) and sum +1 on a success counter, and +1 on a error counter when sucess/error, after ajax complete (erro/sucess) it resend the ajax request

after +- 10000 requests memory jump from 43 MB to 85MB in firefox (running firefox 5.0.1) at chrome it work with 33-45 and never grow

with +- 20000 request chrome continue with 33-45 mb and firefox get 130MB

check the link (it's a ziped file)

www.spadim.com.br/bug.jquery.zip

thanks guys

Attachments (0)
Change History (7)

Changed August 14, 2011 12:11AM UTC by roberto@spadim.com.br comment:1

this is the same as

Ticket #9715

i couldnt save at jsfiddle

but put this code at html and press run:


<script language='javascript'>
var contador=0;var last_contador=0;
var contador_erro=0;
var contador_sucess=0;
var velocidade='';
function tmp_tempo(){
    velocidade=(contador-last_contador);
    last_contador=contador;
}
function show_error(){contador_erro++;}
function show_sucess(){contador_sucess++;}
function get_values(){
    jQuery.ajax({
            type: "GET",
    url:"/echo/blank", // if i could change it to a blank page, could memory leak faster...
            data:"frame=1",
            dataType:"text",
            cache:true,
            complete:show_values,
            error: show_error,
            success: show_sucess
        });
}
function show_values(){
    get_values();
    contador++;
    document.getElementById('conta').innerHTML="contador:"+contador+" [erro: "+contador_erro+", sucess: "+contador_sucess+"], velocidade: "+velocidade+"/s";
}
get_values();    // start loop...
tmp_tempo();
setInterval("tmp_tempo()",1000);
</script>
<span id='conta'></span>
</body>
</html>

Changed August 14, 2011 12:15AM UTC by anonymous comment:2

i got this link at jsfiddle

could you check if it's ok? i never used fiddle before

http://jsfiddle.net/vBJXK/

Changed August 16, 2011 05:12AM UTC by addyosmani comment:3

component: unfiledajax
owner: → roberto@spadim.com.br
priority: undecidedlow
status: newpending

Could you let us know how you're detecting the memory leak?

Changed August 16, 2011 03:12PM UTC by roberto@spadim.com.br comment:4

status: pendingnew

i'm running windows process manager (with firefox, i.e.) and checking memory usage after some minutes

on google chrome i'm using the google chrome task manager that show memory usage

Changed August 16, 2011 06:17PM UTC by roberto@spadim.com.br comment:5

on some tablets (android) i execute it on default android webbrowser and it stop browser after some hours (no more memory), ok i don´t know what engine the default browser run, but maybe a variation of webkit webkitgtk or another one, maybe gecko...

but let´s focus on firefox,midori,internet explore,safari,google chrome, since i´m using it on desktop for now

Changed August 18, 2011 05:15PM UTC by dmethvin comment:6

resolution: → duplicate
status: newclosed

Changed August 18, 2011 05:15PM UTC by dmethvin comment:7

Duplicate of #10013.