Reputation: 2337
I've seen some other posts on this, but it appears that when i do ajax calls with jquery over and over again (every 30 seconds in my case), I get a memory leak. Changing from a $get to a $post (whilst more secure as well) cuts down on the size - it still happens. Even if I do NOTHING in the response.
Any ideas anyone?
EDIT:
Here is the code - sorry for not including it the first time....
$.post("Home/GetDashboard", { monitorDate: monitorDate }, function(data) {
$.each(data, function() {
// this code has been removed to help isolate leak
});
}, 'json');
This will cause a memory leak each time of around 50 kb. That's give or take. I have a lot of DOM code in the $.each() function and when I include that, the memory leak jumps to about 100 kb with each call. I am calling this function every 30 seconds using jQuery timers.
I was using the $.getJSON method, but the memory leak with that was more like 300 kb (YIKES!)
Upvotes: 3
Views: 566
Reputation: 78677
We really need some evidence.
Can you include any stats & screen grabs? Which browsers & OS's are you talking about?
You also need to show some code, are you replacing large fragments of the DOM? (if your using crappy update panels wrapped around large forms then this is a real possibility!) If so how are you doing it?
What tool did you use to find the leak(s)?
Can you recreate the issue on jsbin or jsfiddle?
Upvotes: 0
Reputation: 21137
You need to determine which process is growing. If its ASP.NET then you can run a memory profiler such as ANTS. If your browser process is continuing to grow then you need to assess the DOM and find out what's happening with a tool like FireBug.
Upvotes: 2