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

RPC buffer error #49

Closed duketwo closed 4 years ago

duketwo commented 4 years ago

Hey,

I'm trying to use the RPC buffer. It's injected in a process via easyhook with bootstrapped CLR.

This line

new RpcBuffer("Test");

Results in:

System.IO.IOException: Nicht ausreichend Speicher für die Zuordnung der Ansicht (Not enough memory to map the view) bei System.IO.MemoryMappedFiles.MemoryMappedView.CreateView(SafeMemoryMappedFileHandle memMappedFileHandle, MemoryMappedFileAccess access, Int64 offset, Int64 size) bei System.IO.MemoryMappedFiles.MemoryMappedFile.CreateViewAccessor(Int64 offset, Int64 size, MemoryMappedFileAccess access) bei SharedMemory.SharedBuffer.Open() bei SharedMemory.CircularBuffer..ctor(String name, Int32 nodeCount, Int32 nodeBufferSize) bei SharedMemory.RpcBuffer..ctor(String name, Int32 bufferCapacity, RpcProtocol protocolVersion, Int32 bufferNodeCount)

Any idea what could cause that problem?

justinstenning commented 4 years ago

@duketwo I'm assuming this is the master (i.e. first one to create the buffer)

Try using smaller buffer size and/or node count e.g.

// bufferCapacity default 50000
// bufferNodeCount default 10
new RpcBuffer("Test", bufferCapacity: 1024*10, bufferNodeCount: 5)
duketwo commented 4 years ago

That didn't work. However, adding the source code to the project did resolve all the issues.

Thanks for the fast response. Great work btw :) Have a nice day.

justinstenning commented 4 years ago

Not sure why that would work, but glad its sorted