Python – Share a large (read-only) binary string between Python processes?

Share a large (read-only) binary string between Python processes?… here is a solution to the problem.

Share a large (read-only) binary string between Python processes?

< partition >

I

have a large read-only bytes object that I need to operate on across multiple different Python (3) processes, each of which “returns” (adds to the result queue) a list of results based on their work.

Since this object is very large and read-only, I want to avoid copying it into the address space of each worker process. The research I’ve done shows that shared memory is the right way to fix this, but I can’t find good resources/examples of how to do this using multiprocessing. Module.

Thanks in advance.

Related Problems and Solutions