How to use .NET Memory Mapped File in Linux without persisted file?

Viewed 1500

Using .NET (dotnet 5.0) on Linux, MemoryMappedFile.CreateFromFile() works (but does not support mapName), but CreateNew() and CreateOrOpen() and OpenExisting() throw System.PlatformNotSupportedException: Named maps are not supported.. Since named maps are not supported, it means only persisted file-backed memory maps are supported.

Is there some way to get a memory based, non-persisted MMF in .NET on linux? Perhaps some mono library, or something else in NuGet? Or even a working example using pinvoke?

I would like to share memory in linux between a C# .NET application, and some other applications, possibly in C, C++, and/or python. It is desirable to use shared memory rather than sockets or pipes, because I don't want data to wait in a buffer if the consumer isn't available.

0 Answers
Related