Script stack space exhausted firefox

女生的网名这么多〃 提交于 2020-01-01 03:41:08

问题


I am working with a large XML response from a web service. When I try to get that using a URL, after some time it displays an error in Firebug that "script stack space quota is exhausted" How can i resolve that?


回答1:


It sounds like there is some recursion going on when processing the xml, that is essentially causing a stack overflow (by any name).

Thoughts:

  • work with less data
  • if you are processing the data manually, try to use less recursion? perhaps manual tail-call or queue/stack based
  • consider json - then you can offload to the script host to rehydrate the object without any extra processing



回答2:


Have you tried disabling Firebug?




回答3:


As of Firefox 3, the available stack space has dropped from 4MB to ~= 640KB (I'm passing on word of mouth here).

Do you happen to be running FF3?

https://bugzilla.mozilla.org/show_bug.cgi?id=420874




回答4:


I had a similar problem, maybe the same. This can happen if you try to parse a huge chunk of html with jQuery $(html).

In my tests this only happened on Firefox 3.6.16 on Windows. Firefox 4.0.1 on Ubuntu behaved much better. Probably nothing to do with the OS, just the script engine in 4.x is much better..

Solution: Instead of

var $divRoot = $(html);

I did

var $temp = $('<div style="display:none;">');  // .appendTo($('body'));  // (*)
$temp.html(html);  // using the client's html parsing
var $divRoot = $('> div', $temp);  // or .children() or whatever
// $temp.remove();  // (*)

(*) I remember that in some cases you need to add the temp node to the body, before jquery can apply any selectors. However, in this case it seemed to work just fine without that.

There was absolutely no difference on FF 4.x, but it did allow to avoid the stack space overflow error on FF 3.x.



来源:https://stackoverflow.com/questions/1000211/script-stack-space-exhausted-firefox

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!