That's what I feared. Thank you for having taken a look at this!
On Nov 14, 10:03 pm, "John Resig" <[EMAIL PROTECTED]> wrote:
> I'm currently leaning towards a bug in Firefox. At first blush I'm
> going to guess that it has something to do with the closure that's
> being created across the interval callback.
>
> --John
>
> On Fri, Nov 14, 2008 at 7:53 AM, Selim <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > I recently discovered a rather strange behaviour under Firefox 3. I
> > have been able to reproduce it on Firefox 3.0.3, 3.1b1 as well as the
> > latest nightly build with TraceMonkey enabled. Neither Chrome, IE7,
> > nor Opera (9.62) exhibit this behaviour. It occurs when changing many
> > time the position of a large number of elements by modifying their CSS
> > attributes to generate an animation.
>
> > It's not exactly a memory leak because after some times ff3 seams to
> > detect it and frees the memory. But this garbage collection takes a
> > lot of CPU thus making the animation very laggy at the time it occurs.
>
> > This is the shortest code that I've been able to find that generate
> > this. I used as few jQuery functions as possible to isolate the
> > problem.
>
> > var counter = 0;
> > var id = setInterval("refresh()",30);
>
> > function refresh(){
> > //This doesn't leak:
> > /*
> > counter++;
> > var children = document.getElementById("ground").childNodes;
> > for(i = 0; i < children.length; i++){
> > if(children[i].style){
> > children[i].style.left = ""+counter+"px";
> > }
> > }*/
> > // But this does a lot!
> > counter++;
> > var children = document.getElementById("ground").childNodes;
> > for(i = 0; i < children.length; i++){
> > $(children[i]).css("left", counter);
> > }
> > // this just stops the animation after a certain time
> > if(counter > 300 )clearInterval(id);
> > }
>
> > When running this simple example you'll see the memory used by Firefox
> > going up by 20 to 30mo in a mater of seconds. The full example (js
> > +html) can be find athttp://gamequery.onaluf.org/ff3mljq/it uses a
> > recent nightly build of jQuery but the exact same thing occurs with
> > 1.2.6. Any Idea of what is going on here ? Is this a bug in firefox,
> > is there something I'm doing wrong in my code?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jQuery Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---