Solved

Firefox 2.0.0.14 Memory Leak when making any AJAX calls

Posted on 2008-06-10
5
586 Views
Last Modified: 2013-12-07
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

0
Comment
Question by:cyberena
  • 3
  • 2
5 Comments
 
LVL 18

Expert Comment

by:ChetOS82
ID: 21753315
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.
0
 

Author Comment

by:cyberena
ID: 21753758
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.
0
 

Author Comment

by:cyberena
ID: 21753770
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.
0
 
LVL 18

Accepted Solution

by:
ChetOS82 earned 500 total points
ID: 21753909
I figured out the problem (on my machine at least).  I turned off the XMLHttpRequest logging in Firebug (by going to the Console tab, clicking on Options and unselecting "Show XMLHttpRequest").  I restarted Firefox and monitored the memory usage.  It held steady (up or down <1K).  I verified that requests were being made using WireShark.

I then opened Firebug back up and asked it to show the XMLHttpRequests and Firefox's memory started increasing.
0
 

Author Closing Comment

by:cyberena
ID: 31465807
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.  
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
regx  exclude  pattern 6 28
JavaScript: Issue with onClick 5 36
Wrapper for APPs 9 35
bootstrap footer centering and columns alignement 3 22
If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo‚Ķ
This video teaches users how to migrate an existing Wordpress website to a new domain.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now