My understanding of how memory mapped files work in C # is that every data request leads to copying. For example, if you had a large data structure that was saved as a file, using a memory mapped file would result in memory for the actual file mapped to RAM and a copy located in the GC heap after reading it from the file.
I guess this is because pointers and GC don't get along well with each other at all.
So is there a way around this?
- Perhaps through some C ++ mixed mode that can display a managed API through memory mapped data?
- How about manipulating a direct pointer with unsafe C #?
The common problem I'm trying to solve is sharing a large data structure between multiple processes. The data structure is used to answer a small set of “questions” that can be represented as a simple API (i.e., basically a highly specialized index of many other data).
On the other hand, does this make the .NET API useless for the “data-sharing” scenario?
David source
share