mutouyun / cpp-ipc

C++ IPC Library: A high-performance inter-process communication using shared memory on Linux/Windows.
Other
1.76k stars 337 forks source link

maximum possible data_length. #97

Open binary-husky opened 1 year ago

binary-husky commented 1 year ago

I'm trying to achieve large message ping-pong between 2 processes, but when I set data_length=8*1024*1024, I get struct inside recv call

data_length=7*1024*1024 --> ok data_length=8*1024*1024 --> fail data_length=16*1024*1024 --> fail

I'm trying to implement one side on C++ and the other side on python with pybind11, thereby I'm having trouble to get a traceback, is 8*1024*1024 special in cpp-ipc?

mutouyun commented 1 year ago

The value of 8*1024*1024 is nothing special in the library. It specifies the size of a single element in the circular buffer, while the buffer size is 255. This means that the total buffer size will be data_length*255, and 8M means the buffer will take up about 2GB of memory. Therefore, you need to check your device to see if the memory is large enough.