Skip to content

dart:io - is there a support for memory-mapped files? #35070

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
isoos opened this issue Nov 6, 2018 · 10 comments
Closed

dart:io - is there a support for memory-mapped files? #35070

isoos opened this issue Nov 6, 2018 · 10 comments
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. type-enhancement A request for a change that isn't a bug

Comments

@isoos
Copy link

isoos commented Nov 6, 2018

Is there any plan to support memory-mapped files in dart:io? It would be nice for server apps that want to keep an index on disk but still access it efficiently.

@kevmoo kevmoo added the type-enhancement A request for a change that isn't a bug label Nov 6, 2018
@kevmoo
Copy link
Member

kevmoo commented Nov 6, 2018

@a-siva ?

@a-siva
Copy link
Contributor

a-siva commented Nov 6, 2018

At this point we don't have any plans for supporting memory-mapped files in dart:io, we can consider adding it at sometime depending on use case and requirements.

@mit-mit mit-mit added the area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. label Nov 7, 2018
@jwinarske
Copy link

@a-siva This would be useful when dealing with Isolate/FFI and zero copy. I could use this right now.

@mraleph mraleph marked this as a duplicate of #35070 Nov 28, 2022
@mraleph mraleph closed this as completed Nov 28, 2022
@mraleph
Copy link
Member

mraleph commented Nov 28, 2022

Duplicate of #49810

@mraleph mraleph marked this as a duplicate of #49810 Nov 28, 2022
@mraleph
Copy link
Member

mraleph commented Nov 28, 2022

@jwinarske you can implement memory mapped IO directly through FFI, no need for dart:io support. See https://github.com/dart-lang/sdk/blob/main/pkg/compiler/lib/src/io/mapped_file.dart for example.

@jwinarske
Copy link

@mraleph the example references:

Regenerate by running dart mmap.dart gen

Where do I find mmap.dart?

@mraleph
Copy link
Member

mraleph commented Nov 30, 2022

@jwinarske
Copy link

@mraleph Thank you!

@renatoathaydes
Copy link

The link that was supposed to show an example of using FFI for mmap unfortunately linked to the main branch which currently uses the mmap package instead of FFI.
The mmap package does use FFI and only works on Unix: https://github.com/farshed/mmap/blob/main/lib/src/unix.dart

@mraleph
Copy link
Member

mraleph commented Aug 16, 2024

@renatoathaydes mmap package is here (and it is not published): https://github.com/dart-lang/sdk/tree/main/pkg/mmap, and yes it currently only supports Linux, though it would be fairly trivial to update it to support Windows and Mac.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

7 participants