Re: [jQuery] Tips and tricks for fixing memory leaks

2009-12-07 Thread Carlos De Oliveira
try to use *.min *codes (minimized versions of .js), also may remove Jquery
UI sections from *JQuery.ui.min.js*.


-- 
Carlos De Oliveira
Departamento De Sistemas
Consultor Senior
0426 517 73 01
0212 204 69 60
cdeolive...@grupozoom.com
card...@gmail.com


Re: [jQuery] Tips and tricks for fixing memory leaks

2009-12-07 Thread Olivier Percebois-Garve
Is it a leak or a pseudo-leak ?

leak - page is being reloaded
pseudo-leak - no reload

First you should know that firebug leaks a lot of memory, so you should
perform your memory test with firebug disabled, ideally with all ff plugins
disabled.


The first and easiest to spot source of pseudoleaks is an ever growing dom.
Use your app, for instance add/remove things and verify if the dom keeps
growing. If it is the case, the added elements should tell you where the
issue comes from.

Another easy source of instability, is people forgetting to declare their
vars with the var prefix. Under firebug, use the script tab and type
window in the new watch expression field. That should give you all the
js data of you app. Pollution of the global namespace often indicates that
the var prefix has been forgotten.

jQuery prevent certain memory leaks ofr you. but jQuery is getting fooled if
its methods are not being used. For instance the use of innerHTML = 
instead of jQuery's remove() or empty() will produce leaked event handlers.
So do a gloabal search for that in you app.

There is a memory profiler  extension in firefox, it works with FF3.5+.
use it. https://addons.mozilla.org/en-US/firefox/addon/14666

In general, I'll advice you a dichotomic analysis of your app. Disable the
half of your app, and check if the leak is there. If yes, then the leaks
comes from the non-disabled part, if no, it comes from the disabled part.
With that process you can isolate the issue.

HTH

olivvv

Normally


On Sun, Dec 6, 2009 at 3:03 PM, James Gibson james.t.gib...@gmail.comwrote:

 I am using about 25 jquery plugins along with 1.3.2 and jquery ui 1.7.
 After using my app for a while firefox starts eating up memory and it
 can get up to 500MB and more. What tips and tricks to you guys find
 help eleminate memory leaks in your code?

 Thanks,
 James



Re: [jQuery] Tips and tricks for fixing memory leaks

2009-12-07 Thread Michael Geary
Minifying your code and removing unused code are good ways to reduce your
initial memory footprint, but they won't have any effect on memory leaks.

A memory leak is when the browser's memory use continues to increase, either
as as you interact with a page or when you reload the page or navigate to
another page.

(I don't make the distinction between leaks and pseudo-leaks that
Olivier mentioned. I've seen that terminology in the famous IE memory leak
paper, but I find it hopelessly confusing. It's easier for me to just say
what is actually happening: the page leaks memory as you interact with it
or the page leaks memory when you reload or exit from it.)

-Mike

On Mon, Dec 7, 2009 at 7:32 AM, Carlos De Oliveira 
cdeolive...@grupozoom.com wrote:

 try to use *.min *codes (minimized versions of .js), also may remove
 Jquery UI sections from *JQuery.ui.min.js*.


 --
 Carlos De Oliveira
 Departamento De Sistemas
 Consultor Senior
 0426 517 73 01
 0212 204 69 60
 cdeolive...@grupozoom.com
 card...@gmail.com



[jQuery] Tips and tricks for fixing memory leaks

2009-12-06 Thread James Gibson
I am using about 25 jquery plugins along with 1.3.2 and jquery ui 1.7.
After using my app for a while firefox starts eating up memory and it
can get up to 500MB and more. What tips and tricks to you guys find
help eleminate memory leaks in your code?

Thanks,
James