MmapRaw from anonymous?

Is there a way to create a MmapRaw from an anonymous instead of file backed ?

If so, how? If not, is there a reason it can't be done ?

It looks like MmapMut::map_anon() creates an anonymous MmapMut, and MmapMut::make_read_only() can convert it into an Mmap, but there is no way to create an MmapRaw from it. I don't see any reason why memmap2 couldn't support it, since all three types are just wrappers for an MmapInner. Note that MmapMut is completely safe to use in this context, since nothing else has access to the anonymous map.

1 Like