mreq
mreq

Reputation: 6542

jQuery catch "RangeError: Maximum call stack size exceeded"

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.

Upvotes: 2

Views: 9356

Answers (1)

Split Your Infinity
Split Your Infinity

Reputation: 4229

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.

Upvotes: 5

Related Questions