79217578

Date: 2024-11-23 10:07:05
Score: 0.5
Natty:
Report link

[ Answers ]

  1. The alternative to ctypes.c_wchar_p string is to use ctypes.c_char bytes-string. The downside is you need to .decode() and .encode() each time you access the value.

  2. Use multiprocessing.Array('c', b'bytes-string') to replace Value() for string shared memory. Using Value() will raise in an exception "bytes is too long"

[ Summary ]

As summary for future self:

  1. Use multiprocessing.Array() for shared string
  2. Use multiprocessing.Value() for shared int
  3. Use multiprocessing.shared_memory.ShareableList() for shared list
  4. Use multiprocessing.Manager() for shared memory as Proxy, unrecommended because it's slow.
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Guild