views:

88

answers:

2

I was doing some cross browser testing on certain piece of functionality today, and ran across a rather nifty little gem.

In IE8: Out of memory at line: 99

In IE7: Out of memory at line: 100

In IE6: Stack overflow at line: 101

From what I've been able to dig up, most of the time these messages start appearing, it's an issue with having an array in which the number of elements is greater than 65,535. However, I don't believe that that's the issue at hand here.

The functionality in question is an action from within an iframe "closing" the current iframe and "opening" another using jQuery. It's actually happening on the close/open interaction.

Has anyone seen anything like this before?

Edit: Upon further investigation, it doesn't actually seem to be related to the iframes. Still digging, but any suggestions would be appreciated.

A: 

It would seem that you take too much memory with something and IE does not have so much memory allocated for that kind of something :) Other browsers do. If you take a look at those line numbers that you have or debug your code with IE8 developer tools you should get your answer.

If it is not a recursion it may be a loop that keeps eating more memory until it runs out.

avok00
+2  A: 

So it turned out to be an issue with IE and everything else handling things differently...as usual.

I have a function that I'm using to throw an error, and it's recursive by design. I wanted the error to be displayed in the main Document, not an iframe (which are being used extensively on this site, unfortunately). The gist of my function is as follows:

myClass.myErrorFunc = function ( msg ) {
    if ( parent !== window ) {
        parent.myClass.myErrorFunc( msg );
    } else {
        // display the error
    }
}

This works GREAT in Chrome and Firefox. It recurses one level and does the error displaying in the main window because once it gets to the top level, the parent is itself. Apparently in IE, however, window's parent is NEVER itself. Thus, infinite recursion.

Stay tuned for a solution.

Edit: Apparently, it was an issue with using !== instead of !=. When I switched it to !=, the second time through (as this is being run from an iframe), window == parent evaluates true, but window === parent does not...

Whatever, I'll take it...

Thanks for your help guys.

Collin Klopfenstein