javascript - jQuery catch "RangeError: Maximum call stack size exceeded" - Stack Overflow

I have a page, that works fine in FF and IE. However, chrome throwsjquery.min.js:2Uncaught RangeErr

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.

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.

Share Improve this question edited May 23, 2017 at 12:08 CommunityBot 11 silver badge asked Aug 20, 2012 at 15:37 mreqmreq 6,5424 gold badges38 silver badges57 bronze badges 5
  • 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 Commented Aug 20, 2012 at 15:42
  • 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 Commented Aug 20, 2012 at 15:58
  • You didn't post any code. You say there's no recursion, but that's obviously the most likely cause of the problem. – Pointy Commented Aug 20, 2012 at 16:03
  • 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 Commented Aug 20, 2012 at 16:06
  • @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 Commented Aug 20, 2012 at 16:10
Add a ment  | 

1 Answer 1

Reset to default 5

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.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742389562a4434739.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信