Tuesday, 22 June 2021

Python getting shared memory: size is not consistent

Process 1:

shm=multiprocessing.shared_memory.SharedMemory(name="shm", create=True, size=10000)
print(shm.size)

Prints 10000

Process 2:

shm=multiprocessing.shared_memory.SharedMemory(name="shm")
print(shm.size)

Prints 12288

The problem is that I'm trying to use the buffer to back a numpy array. Then numpy complains it cannot reshape() the array because it is not the same size.



from Python getting shared memory: size is not consistent

No comments:

Post a Comment