加载巨大的数组在Internet Explorer 11的原因堆栈溢出 [英] Loading huge array in Internet Explorer 11 cause stack overflow
问题描述
我有一个非常大的锯齿状数组(生成)页面。它不IE11初始化;我得到 SCRIPT28:堆栈空间不足
和 SCRIPT2343:在行堆栈溢出:1
。我有问题的页面已经减少到最低限度,用随机的数据,这是它的样子:
I have a (generated) page with a very large jagged array. It does not initialize in IE11; I get SCRIPT28: Out of stack space
and SCRIPT2343: Stack overflow at line: 1
. I have reduced the problematic page to the bare minimum with randomized data, and this is what it looks like:
<html><body>
<div id="info">
Loading...
</div>
<script>
var d = [];
var i = 0;
d[i++] = [
"XHC_14",
0
];
d[i++] = [
"ZXS_26",
"UVT_27",
"QML_3149",
"MJO_3150",
15993327
];
d[i++] = [
"VKG_3156",
"ZEA_3157",
"KZG_3159",
"MNA_3162",
"AKX_3163",
"KLK_3164",
618601
];
// more array initialization ...
info.innerHTML = "<h1>Ready!</h1>"; // this will only show if the initialization succeeded
</script>
</body></html>
真正的文件是500K〜线,围绕重复数组初始化〜14K倍。真正的文件可在这里:<一href=\"http://www.rlvision.com/misc/ie11_stack_overflow_problem.zip\">ie11_stack_overflow_problem.zip
当数组初始化是足够大,它只会崩溃。我有黑社会各种变化,包括把它在函数内部给它自己的范围,但没有成功。它工作在我测试的所有其他的浏览器,包括IE8在XP。我的配置是与Win7的IE 11.0.9600.17107(完全更新)。
It will only crash when the array initialization is large enough. I have triad all kinds of variation, including putting it inside a function to give it its own scope, to no avail. It works in all other browsers I tested, including IE8 on XP. My config is Win7 with IE 11.0.9600.17107 (fully updated).
谁能弄清楚为什么会这样?
Can anyone figure out why this is happening?
推荐答案
这文件是可怕的,是死的,以Visual Studio和记事本++ ...确实IE11的吻。你炸毁跨preTER。
That file is horrendous and is the kiss of death to both Visual Studio and Notepad++... and indeed IE11. You've blown up the interpreter.
我得到这个通过工作
JSON.serialize(d)
在另一个浏览器,然后粘贴输出作为一个字符串到源文件。
in another browser, then pasting the output as a string into the source file.
然后:
var jsonStr = '[[blablabla...I go on foreeeeeever]]';
var d=JSON.parse(jsonStr);
现在它加载在IE11。
Now it loads in IE11.
所以,解决的办法是写你的数据结构作为一个JSON字符串和解析它。
So the solution is to write your data structure out as a JSON string and to parse it.
这篇关于加载巨大的数组在Internet Explorer 11的原因堆栈溢出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!