Fully managed .NET shared memory implementation?

I am looking for free, fully managed shared memory implementations for .NET (P / Invoke for example, mixed C ++ / CLI - no).

+8
c # shared-memory ipc
source share
3 answers

It looks like you are looking for memory files that are supported in the .NET 4.0 BCL.

Starting with the .NET Framework version 4, you can use managed code to access memory-mapped files in the same way that Windows built-in functions access memory-mapped files, as described in "Managing Memory Files in Win32 in MSDN "Library

+8
source share

Well, the .NET platform is free, it is recommended .. NET 4.0 supports the System.IO.MemoryMappedFiles namespace classes. Shared memory is a rather sharp mismatch between impedance and the concept of a garbage collector, so it took some time. Unless you use pointers, copying from the GC heap to the MMF view is inevitable.

Other IPC mechanisms also use shared memory, it is simply not explicit, since it is built into the kernel. All this works at about the same speed, a microsecond, to adjust the display, and then only the bus bandwidth to make a copy with memory to memory. Five gigabytes per second are the slowest you will encounter.

+15
source share

This article explains in section 3 how to wrap MapViewOfFile and friends using P / Invoke.

+2
source share

Source: https://habr.com/ru/post/650614/


All Articles