justinstenning / SharedMemory

C# shared memory classes for sharing data between processes (Array, Buffer and Circular Buffer)
https://www.nuget.org/packages/SharedMemory
Other
566 stars 118 forks source link

Dynamically Growing/Allocatable SharedMemory Buffer (w/ code!) #11

Open MikeFair opened 8 years ago

MikeFair commented 8 years ago

Hi all,

I just posted the following Gist as an initial cut on making dynamic shared memory. https://gist.github.com/MikeFair/6908afe26e0b84758ca4

The main idea is that (bufferPosition / blockSize) gives a unique segmentId. "BufferName - [segmentId]" is then the file name of that segment which participants can test for the existence of and load them if they exist. if they do not exist, then participants can create them as they write data into those memory addressses.

There is no signalling happening about new segments; but attempts to read any segments that exist will be dynamically discovered.

Thanks!

kasajian commented 8 years ago

Can you explain how can be used?

quicktrick commented 7 years ago

I'm interested in this solution too. I need to fast transfer large portions of data of unpredictable volume. I can solve it by means of some intermediate CircularBuffer, but dynamically allocated shared memory looks more attractive. Now it's easier for me to make my own solution with CircularBuffer, because it's hard to study smb. else's code, but if there is more or less working solution, I'd like to try it. Could you please give some examples if any?