非标准的Large-Allocation
响应头部是用来告诉浏览器加载该页面可能需要申请大内存. 当前只有Firefox实现改特性,但是对其他浏览器也无损害。
WebAssembly 或者 asm.js会使用比较大的连续内存空间。例如, 对于一些复杂的游戏, 其申请的空间将会非常大,甚至会达到1GB。Large-Allocation
告诉浏览器其将要加载的页面可能需要申请一个大的连续内存空间,浏览器依据该头部可能会单独启动一个专有的进程用于处理改页面。
Header type | Response header |
---|---|
Forbidden header name | no |
Syntax
Large-Allocation: 0 Large-Allocation: <megabytes>
Directives
0
- 0 is a special value which represents uncertainty as to what the size of the allocation is.
<megabytes>
- 预期需要申请的内存大小,以M为单位
Examples
Large-Allocation: 0 Large-Allocation: 500
Troubleshooting errors
The Large-Allocation
header throws warnings or error messages when used incorrectly. You'll encounter them in the web console.
- This page was loaded in a new process due to a
Large-Allocation
header. - This message means that the browser saw the
Large-Allocation
header, and was able to reload the page into a new process which should have more available contiguous memory. - A
Large-Allocation
header was ignored due to the load being triggered by a non-GET request. - When a
POST
request is used to load a document, that load cannot currently be redirected into a new process. This error is displayed when loading a document with aLarge-Allocation
header with a non-GET HTTP method. This could be caused due to the document being loaded by a form submission, for example. - A
Large-Allocation
header was ignored due to the presence of windows which have a reference to this browsing context through the frame hierarchy orwindow.opener
. -
This error means that the document was not loaded at the top level of an user-opened or noopener-opened tab or window. It can occur in these situations:
- The document with the
Large-Allocation
header was loaded in an<iframe>
. Firefox cannot move an iframe into a new process currently, so the document must load in the current process. - The document with the
Large-Allocation
header was loaded in a window which was opened bywindow.open()
,<a target="_blank">
or other similar methods withoutrel="noopener"
or the"noopener"
feature being set. These windows must remain in the same process as their opener, as they can communicate, meaning that we cannot allow them to switch processes. - The document with the
Large-Allocation header
has opened another window withwindow.open()
,<a target="_blank">
or other similar methods withoutrel="noopener"
or the"noopener"
feature being set. This is for the same reason as above, namely that they can communicate and thus we cannot allow them to switch processes.
- The document with the
- A
Large-Allocation
header was ignored due to the document not being loaded out of process. - Firefox has moved to a multiprocess architecture, and this architecture is required in order to support the
Large-Allocation
header. Some legacy Addons can prevent Firefox from using this new, faster, multiprocess architecture. If you have one of these Addons installed, then we will continue to use the old single process architecuture for compatibility, and cannot handle theLarge-Allocation
header. - This page would be loaded in a new process due to a
Large-Allocation
header, howeverLarge-Allocation
process creation is disabled on non-Win32 platforms. - Firefox currently only supports the
Large-Allocation
header in our 32-bit Windows builds, as memory fragmentation is not an issue in 64-bit builds. If you are running a non-win32 version of Firefox, this error will appear. This check can be disabled with the "dom.largeAllocation.forceEnable" boolean preferece in about:config.
Specifications
Not part of any current specifications. An explainer of the ideas behind this header can be found in this document.
Browser compatibility
The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Feature | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|---|
Basic Support | No | No | 53 | No | No | No |
Feature | Android | Chrome for Android | Edge mobile | Firefox for Android | IE mobile | Opera Android | iOS Safari |
---|---|---|---|---|---|---|---|
Basic Support | No | No | No | No | No | No | No |