Link to home
Start Free TrialLog in
Avatar of cyberena
cyberena

asked on

Firefox 2.0.0.14 Memory Leak when making any AJAX calls

Very simply, if you continue to make AJAX calls in FireFox, and watch the memory usage in task manager, it constantly grows and if left over night may crash the browser.

I need the constant polling because we are monitoring data that needs to constantly be updating the screen.

Does anyone know how to work around or fix this memory leak?

Here's a simple page doing nothing but AJAX requests in an infinite loop (you can see the request using FireBug or some other http viewer)

http://www.cyberena.com/Production/ajaxtest/jqcall.html

Avatar of ChetOS82
ChetOS82
Flag of United States of America image

I don't think this is a memory leak in Firefox, because it jQuery uses Firefox's XmlHttpRequest object.  I have been using that object for years and (when used right) never had a problem.

What happens if you point your success callback to a function other than the calling function?  If you need it to process in a loop, then have the callback function call the "theCall" function again.

Also, jQuery provides $.get() which might be better suited for your needs.
Avatar of cyberena
cyberena

ASKER

Hello,

I have used JQuery and Prototype and my own engine I wrote before those open sources even existed for AJAX calls and all three produce the same results no  matter if the callback function is hitting itself or another function.

A possible reason you have not seen it is perhaps you are not polling data as often as I am in the example I provided which is every 50ms plus or minas for over night or longer periods of time since the application I am writing monitors robots.

I believe if you try to do an infinite request loop, and watch the memory in task manager, you can also reproduce the problem in FF 2.

It seems FF 3 beta has resolved this problem, and no leak in IE either.  But I am hoping to find a workaround for now for FF 2 since many people use FF2 today.
One more thing to note, the memory leak is apparent after just a few minutes of inifinite looping, you dont have to wait overnight to see the memory grow.
ASKER CERTIFIED SOLUTION
Avatar of ChetOS82
ChetOS82
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you, unfortunately all of my systems I dev on use FireBug, I never thought of the memory increase being due to FireBugs logging but it makes sense.