jQuery.ajax ($.ajax) and its memory leaking (BUG) – How to solve it?

Hi everyone, today I faced a serius problem with an application suffering of memory leaking. After almost get crazy I could isolate the problem and I figured out the problem was the jQuery.ajax.

All my pain I posted in here (http://stackoverflow.com/questions/8158739/ie-memory-leak-and-eval-with-jquery/8176724#8176724) but I didn’t receive any answer, hopefully I could manage that by myself.

Summarizing, if you will use in your application jQuery.ajax, which will be called in a regular basis (like every 10 seconds) I’d recommend you to make the call as below:

var request = $.ajax({ .... });

It will create a reference of that request to the declared variable (request).

When finished the request, YOU must do by yourself this:

 request.onreadystatechange = null;  
 request.abort = null;  
 request = null;

jQuery.ajax doesn’t do that and the memory never releases. 

Let me know if it was useful for you.

Um comentário sobre “jQuery.ajax ($.ajax) and its memory leaking (BUG) – How to solve it?

Deixe uma resposta

Preencha os seus dados abaixo ou clique em um ícone para log in:

Logotipo do WordPress.com

Você está comentando utilizando sua conta WordPress.com. Sair / Alterar )

Imagem do Twitter

Você está comentando utilizando sua conta Twitter. Sair / Alterar )

Foto do Facebook

Você está comentando utilizando sua conta Facebook. Sair / Alterar )

Foto do Google+

Você está comentando utilizando sua conta Google+. Sair / Alterar )

Conectando a %s