148
edits
(→Q & A) |
|||
| Line 124: | Line 124: | ||
* '''Can we write to a memory-mapped array buffer?''' | * '''Can we write to a memory-mapped array buffer?''' | ||
: The array buffer is mapped as copy-on-write by private mapping. If you write to a memory-mapped array buffer, it's not visible to other processes mapping the same file, and the updates are not carried through to the underlying file. However, you should avoid that because it introduces heap memory allocation when writing to the address of each page in the virtual address space. | : The array buffer is mapped as copy-on-write by private mapping. If you write to a memory-mapped array buffer, it's not visible to other processes mapping the same file, and the updates are not carried through to the underlying file. However, you should avoid that because it introduces heap memory allocation when writing to the address of each page in the virtual address space. | ||
* '''Can we pass a memory-mapped array buffer between main/worker thread?''' | |||
: Yes, there are two ways to pass array buffer by postMessage() | |||
:1. Structured clone | |||
::* The destination array buffer becomes a normal array buffer | |||
:2. Transferable objects | |||
::* Ownership transfered to destination array buffer, still memory-mapped | |||
::* Source array buffer is neutered after transfer | |||
* '''Is it possible to apply memory-mapped array buffer on blobs coming from IndexedDB?''' | * '''Is it possible to apply memory-mapped array buffer on blobs coming from IndexedDB?''' | ||
: Yes, there is a follow up at https://bugzilla.mozilla.org/show_bug.cgi?id=988815 | :Yes, there is a follow up at https://bugzilla.mozilla.org/show_bug.cgi?id=988815 | ||
edits