title: Combine Pool.map with shared memory Array in Python multiprocessing
body: <p>I have a very large (read only) array of data that I want to be processed by multiple processes in parallel.</p>
  <p>I like the <code>Pool.map</code> function and would like to use it to calculate functions on that data in parallel.</p>
  <p>I saw that one can use the <code>Value</code> or <code>Array</code> class to use shared memory data between processes. But when I try to use this I get a <code>RuntimeError: 'SynchronizedString objects should only be shared between processes through inheritance</code> when using the Pool.map function:</p>
  <p>Here is a simplified example of what I am trying to do:</p>
  <pre><code>from sys import stdin
  from multiprocessing import Pool, Array
  
  def count_it( arr, key ):
    count = 0
    for c in arr:
      if c == key:
        count += 1
    return count
  
  if __name__ == '__main__':
    testData = &quot;abcabcs bsdfsdf gdfg dffdgdfg sdfsdfsd sdfdsfsdf&quot;
    # want to share it using shared memory
    toShare = Array('c', testData)
  
    # this works
    print count_it( toShare, &quot;a&quot; )
  
    pool = Pool()
  
    # RuntimeError here
    print pool.map( count_it, [(toShare,key) for key in [&quot;a&quot;, &quot;b&quot;, &quot;s&quot;, &quot;d&quot;]] )
  </code></pre>
  <p>Can anyone tell me what I am doing wrong here?</p>
  <p>So what I would like to do is pass info about a newly created shared memory allocated array to the processes after they have been created in the process pool.</p>