JavaScript memory limit

后端 未结 6 1938
青春惊慌失措
青春惊慌失措 2020-11-28 11:42

Is there a maximum amount of data a JavaScript application can store?

I guess this is handled by the browser and each one has its limitation?

If there isn\'t

6条回答
  •  南方客
    南方客 (楼主)
    2020-11-28 12:21

    This may vary between different web browsers, from observation, Iv'e picked up with Chrome(ver. 79.0.3945.130) the maximum is 2Gb per task. The Chrome debugger will pause the web page as the "Paused before potential out-of-memory crash" message comes up.

    However, the debugger does allow one to resume web page operation(usually resulting in web page crash) but if it doesn't crash, the memory used can climb well above 2Gb, the page will generally perform slower beyond this point. It seems as if the 2Gb is set on a per task basis.

    ie: I have developed a real time web based Log viewer that displays the Log info, read from some local log files. One can request what percentage of the log file to view. Some of the Log files are large and can contain 100 000 plus lines. When requesting to view all those lines Chrome will crash, but if I request to view those lines 10 000 lines at a time, no problem at all. this brings me to the "2Gb max per task" conclusion.

    This is only a theory, i stand corrected. Refer to the images attached

提交回复
热议问题