2
votes

I have a page, that works fine in FF and IE. However, chrome throws

jquery.min.js:2    Uncaught RangeError: Maximum call stack size exceeded

It's because of trying to process a lot of data (see Chrome RangeError: Maximum call stack size exceeded when using jQuery $.map).

Is it possible to catch the error, so that the whole page's javascript doesn't hang? Or do I have to reduce the amount of data for chrome.

1
I doubt it has to do with trying to process a lot of data; that other question has no answers, and I doubt it was the problem there too. You posted no code, so it's impossible to say what's going on. - Pointy
There's no recursion in the code. I think that infinite recursion would crash other browser as well. The fact is, that even ie7 is dealing better than webkit in this situation. Also the question is not about helping me, but about being able to catch the RangeError. I don't understand the downvotes... - mreq
You didn't post any code. You say there's no recursion, but that's obviously the most likely cause of the problem. - Pointy
Well, I am not asking to get a direct solution for my problem, but rather to see, whether it's possible, to catch the error on global scope. That's the question, if you read the last paragraph. - mreq
@PetrMarek Sure: try..catch or window.onerror. But, what are you hoping to get out of that other than a solution to the problem? - Jonathan Lonowski

1 Answers

5
votes

JavaScript doesn't support Tail Recursion. You're probably calling a function from a function from a function until it blows. (Please post some code to show what you're doing).

Use a setTimeout between 'iterations'. This way you don't block the UI or blow up the stack.