14

Is there a Python module that would enable me to place instances of non-trivial user classes into shared memory?

By that I mean allocating directly in shared memory as opposed to pickling into and out of it.

multiprocessing.Value and multiprocessing.Array wouldn't work for my use case as they only seem to support primitive types and arrays thereof.

The only thing I've found so far is POSH, but it hasn't changed in eight years. This suggests that it's either super-stable or is out of date. Before I invest time in trying to get it work, I'd like to know if there are alternatives I haven't discovered yet.

I only need this to work on Linux.

0

1 Answer 1

1

That's kind of a tough one. The best solution I can think of is pickling your objects and using a c_char_p with multiprocessing.sharedctypes. You'd still have to make sure no null bytes got into the c_char_p, either by escaping them or converting to hex.

On second thought, maybe you should go with POSH.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.