Do you know the javascript “Delete” operator?

It’s interesting and almost nobody uses it:


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 ( 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.