Maximum call stack size exceeded error

2018-12-31 05:02发布

I am using a Direct Web Remoting (DWR) JavaScript library file and am getting an error only in Safari (desktop and iPad)

It says

Maximum call stack size exceeded.

What exactly does this error mean and does it stop processing completely?

Also any fix for Safari browser (Actually on the iPad Safari, it says

JS:execution exceeded timeout

which I am assuming is the same call stack issue)

24条回答
萌妹纸的霸气范
2楼-- · 2018-12-31 05:37

I am using Devexpress Scheduler in Angular and the problem is the improper using of the variable assigned to datasource tag of the scheduler.

查看更多
像晚风撩人
3楼-- · 2018-12-31 05:39

If you need a infinite process/recursion running for some reason, you can use a webworker in a seperate thread. http://www.html5rocks.com/en/tutorials/workers/basics/

if you want to manipulate dom elements and redraw, use animation http://creativejs.com/resources/requestanimationframe/

查看更多
孤独总比滥情好
4楼-- · 2018-12-31 05:40

In my case, two jQuery modals were showing stacked on top of each other. Preventing that solved my problem.

查看更多
裙下三千臣
5楼-- · 2018-12-31 05:41

you can find your recursive function in crome browser,press ctrl+shift+j and then source tab, which gives you code compilation flow and you can find using break point in code.

查看更多
怪性笑人.
6楼-- · 2018-12-31 05:42

There is a recursive loop somewhere in your code (i.e. a function that eventually calls itself again and again until the stack is full).

Other browsers either have bigger stacks (so you get a timeout instead) or they swallow the error for some reason (maybe a badly placed try-catch).

Use the debugger to check the call stack when the error happens.

查看更多
春风洒进眼中
7楼-- · 2018-12-31 05:42

Both invocations of the identical code below if decreased by 1 work in Chrome 32 on my computer e.g. 17905 vs 17904. If run as is they will produce the error "RangeError: Maximum call stack size exceeded". It appears to be this limit is not hardcoded but dependant on the hardware of your machine. It does appear that if invoked as a function this self-imposed limit is higher than if invoked as a method i.e. this particular code uses less memory when invoked as a function.

Invoked as a method:

var ninja = {
    chirp: function(n) {
        return n > 1 ? ninja.chirp(n-1) + "-chirp" : "chirp";
    }
};

ninja.chirp(17905);

Invoked as a function:

function chirp(n) {
    return n > 1 ? chirp( n - 1 ) + "-chirp" : "chirp";
}

chirp(20889);
查看更多
登录 后发表回答