Bug Tracker

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#10044 closed bug (duplicate)

jquery - ajax with memory leak

Reported by: roberto@… Owned by: roberto@…
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

Change History (7)

comment:1 Changed 12 years ago by roberto@…

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>

comment:2 Changed 12 years ago by anonymous

i got this link at jsfiddle could you check if it's ok? i never used fiddle before http://jsfiddle.net/vBJXK/

comment:3 Changed 12 years ago by addyosmani

Component: unfiledajax
Owner: set to roberto@…
Priority: undecidedlow
Status: newpending

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

comment:4 Changed 12 years ago by roberto@…

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

comment:5 Changed 12 years ago by roberto@…

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

comment:6 Changed 12 years ago by dmethvin

Resolution: duplicate
Status: newclosed

comment:7 Changed 12 years ago by dmethvin

Duplicate of #10013.

Note: See TracTickets for help on using tickets.