Mootools event leak

Posted by user572263 on Stack Overflow See other posts from Stack Overflow or by user572263
Published on 2011-01-12T06:47:31Z Indexed on 2011/01/12 6:54 UTC
Read the original article Hit count: 152

Filed under:

The example to demonstrate the issue can be found here:

link text

The test shows a basic Mootools class that contains an element variable with a click event attached. There’s also a “cleanup” function to remove the event and nullify the element variable.

My problem is that when I loop a thousand times to create the “LeakClass” instance and clean it up, it causes a major memory leak like there’s no tomorrow. I tested this on IE8 and Chrome.

On the other hand what I’ve noticed is that if I comment out the line that adds the “click” event, the code doesn’t leak.

Can somebody please help me structure the class/event in a manner that it doesn’t leak.

Thanks in advance.

© Stack Overflow or respective owner

Related posts about mootools