To Work with a Memory-mapped File
Estela Supple 於 6 小時之前 修改了此頁面


A Memory Wave-mapped file contains the contents of a file in digital memory. This mapping between a file and memory space allows an utility, together with a number of processes, to modify the file by reading and writing on to the memory. You can use managed code to access memory-mapped files in the same means that native Home windows features access memory-mapped files, as described in Managing Memory-Mapped Files. Persisted recordsdata are memory-mapped recordsdata that are related to a supply file on a disk. When the last process has finished working with the file, the data is saved to the source file on the disk. These memory-mapped files are appropriate for working with extremely large source files. Non-persisted files are memory-mapped files that are not associated with a file on a disk. When the final process has finished working with the file, the data is misplaced and the file is reclaimed by rubbish assortment. These information are appropriate for creating shared memory for inter-process communications (IPC).


Memory-mapped files can be shared throughout a number of processes. Processes can map to the identical memory-mapped file by utilizing a typical name that is assigned by the method that created the file. To work with a memory-mapped file, you must create a view of the entire memory-mapped file or a part of it. You too can create multiple views to the same a part of the Memory Wave-mapped file, thereby creating concurrent memory. For two views to remain concurrent, they have to be created from the same memory-mapped file. Multiple views might even be vital if the file is greater than the size of the application's logical memory space available for memory mapping (2 GB on a 32-bit pc). There are two sorts of views: stream entry view and random access view. Use stream access views for sequential access to a file