Javascript string size limit: 256 MB for me - is it the same for all browsers?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Curious about what was the maximum string length I could get in Javascript, I tested it myself, today, on my Firefox 43.0.1, running in Windows 7. I was able to construct a string with length 2^28 - 1 , but when I tried to create a string with one more char, Firebug showed me the "allocation size overflow" error, meaning the string must be less than 256 MB. Is this the same thing for all browsers, all computers, all operational systems, or it depends? I created the following snippet to find out the limit: (function() { strings = ["z"]; try {