Activate your free membership today | Log-in

Wednesday, December 12th, 2007

window.createPopup leaks 80KB in IE 7

Category: IE

Frederico Caldeira Knabben, project manager of the FCK Editor, has been fighting some memory issues and found a new leak:

We at FCKeditor are constantly fighting against memory leak. We have already fixed several related issues, but we were still facing an expressive memory leak with IE7.

With some intuition, we were able to reduce the problem to a simple test case, and we have sadly found a new memory leak issue *introduced* with IE7.

Essentially, every call to window.createPopup() leaks 80Kb of memory. A test page can be found here:

http://www.fredck.com/bugs/ie/createpopupleak.html

In the default FCKeditor interface, we use six IE’s popups for all floating panels (toolbar combos and context menu). On pages with several editor instances, the memory increasing is substantial.

As far as we could understand it, there is no way to “cleanup” that leak. We strongly hope IE8 and even IE7 will have it fixed as there is no way to workaround it (I hope I’m wrong!).

Suggestions? Comments?

Posted by Dion Almaer at 5:49 am

++++-
4.8 rating from 22 votes

12 Comments »

Comments feed TrackBack URI

Are you aware of the the type of leak it is? Circular references? Closures?

Hopefully some JS guru can solve this issue. FCKeditor is a great product. It is good to see you taking these issues seriously. Thanks.

Comment by Site Smart — December 12, 2007

ehm… Did you look at the source to the linked page? The memory-leak is in window.createPopup, not anywhere in FCKeditor

Comment by erlando — December 12, 2007

IE strikes again. I’d point out though that FCK could really use a ditching of pop-ups any way. In-window divs such as those used in Ext JS wont throw security warnings and force people to disable their popup blockers. This might be a good opportunity to refactor your code :)

Comment by Jon Hartmann — December 12, 2007

@Jon: window.createPopup() has nothing to do with the popups we are used to see, which are instead created with window.open(). They behave instead much like a floating iframe, but have some special features (like floating outside the browser itself). Popup blockers don’t block them.

We have made some tests to avoid using window.createPopup, using floating divs or iframes instead. Then, we have another IE bug to fight here, because the cursor caret used on editing will always blink over floating elements, making the editor buggy to the user eyes. Using window.createPopup instead, we avoid this problem.

Of course, we’ll be investigating it further in the future. Thanks for your comments.

Comment by FredCK — December 12, 2007

Hmm, the leak doesn’t happen on my IE7 on Vista by default. It could be the google gears memory leak I found before since when I enable google gears it starts leaking just as you describe. Try disabling google gears if you have that installed to see what happens. Google has fixed this issue in their latest build.

Here is a discussion regarding that leak:
http://groups.google.com/group/google-gears/browse_thread/thread/83c298662c9e0c2/e8c47971f53b4eea?lnk=gst&q=leaks#e8c47971f53b4eea

Comment by Spocke — December 12, 2007

So, was Spocke right?
Should we change the title for this entry to Google Gears Leaks 80KB in IE7?
;)

Comment by skypoet — December 12, 2007

Never mind it still leaks memory. I just leaks more with the gears enabled, it could also be that I have the 64 bit version of the OS. It doesn’t leak 1MB each reload but like 20k hard to spot when the GC makes the values jump up and down.

Comment by Spocke — December 12, 2007

@Spocke : I have it confirmed from various sources, with IE7 on XP and Windows 2003. Probably this is not a bit issue with Vista 64-bit… lucky you :)

Comment by FredCK — December 12, 2007

@FredCK: Yeah, I just confirmed it my self. Tried IE7 on XP Pro and it leaks 1MB each reload but IE7 on Vista 64 bits leaks around 20k so the platform seems to make a difference. But that is a bummer that means event more platform combinations to test on. Isn’t there enough all ready. :)

Comment by Spocke — December 12, 2007

We have done some further research (it turned out that I wasn’t suffering now the leak so we searched for the differences), and as explained in http://alfonsoml.blogspot.com/2007/12/ie7-leaks-due-to-antiphising-protection.html the problem is only present if the Anti-phising protection of IE7 isn’t disabled. That also explains why the problem isn’t present in Drip or sIEve.

Comment by AlfonsoML — December 12, 2007

One question - whatever code you write, you need to make sure it will work in other browsers as well, especially Firefox. So when you are going to write JS code which will create a popup (may be a DIV based) in Firefox, why not use the same code for IE also? Instead of using something that is only IE specific, why not use generic code? Am I missing something here?

Comment by AotearoanBlue — December 13, 2007

@AotearoanBlue : check out my comment to Jon, I think 8 comments above this one.

Comment by FredCK — December 18, 2007

Leave a comment

You must be logged in to post a comment.