Closed dead-claudia closed 2 years ago
@nodejs/fs
Of course, there is a risk of SIGBUS
-based crashes, but that can be avoided through careful management of the file system. (This would necessarily have to be warned about in the docs.)
Prior work in userland.
As the author of the original mmap module: commit bnoordhuis/node-mmap@0f81e51c48 (10 years ago!) mentions why mmap is a terrible idea in an async runtime - it performs blocking I/O.
- paginating them into memory explicitly (mildly inefficient and eats RAM up rapidly) or 2. doing frequent random file access (extremely inefficient for magnetic hard drives).
That's no different with memory-mapped files. They're not some magic bullet.
There has been no activity on this feature request for 5 months and it is unlikely to be implemented. It will be closed 6 months after the last non-automated comment.
For more information on how the project manages feature requests, please consult the feature request management document.
bump to not be stale
I'll go ahead and close this to avoid further content-free bumps. No maintainers spoke out in favor and I personally don't see the need for this to live in core, rather the opposite.
Is your feature request related to a problem? Please describe. I'd like to be able to read and modify large file-based data sets without either 1. paginating them into memory explicitly (mildly inefficient and eats RAM up rapidly) or 2. doing frequent random file access (extremely inefficient for magnetic hard drives).
Describe the solution you'd like Integration of
mmap
/munmap
/msync
for Linux, and equivalent APIs in Windows in a newfs
API. This API would return a memory map handle with a few pieces of functionality:Buffer
whose underlying array buffer encapsulates a pointer over the memory-mapped region.msync
on *nix).munmap
on *nix), detaching the buffer's underlying array buffer. This would also be done implicitly when the handle itself gets collected, to mitigate leaks.I'm omitting support for Linux's
mremap
as there's no direct equivalent in Windows (and the closest equivalent it has is in a part of it that's filled with various caveats).Describe alternatives you've considered See the "without either..." part of the problem description.