title: Python memory allocation error using subprocess.Popen
body: <p>I am doing some bioinformatics work. I have a python script that at one point calls a program to do an expensive process (sequence alignment..uses a lot of computational power and memory). I call it using subprocess.Popen. When I run it on a testcase, it completes and finishes fine. However, when I run it on the full file, where it would have to do this multiple times for different sets of inputs, it dies. Subprocess throws:</p>
  
  <pre><code>OSError: [Errno 12] Cannot allocate memory
  </code></pre>
  
  <p>I found a few links <a href="https://stackoverflow.com/questions/978841/memory-error-in-python">here</a> and <a href="https://stackoverflow.com/questions/4098162/python-memory-error">here</a> and <a href="https://stackoverflow.com/questions/3016347/python-subprocess-cannot-allocate-memory-after-a-few-days-of-not-restarting-apa">here</a> to similar problems, but I'm not sure that they apply in my case.</p>
  
  <p>By default, the sequence aligner will try to request 51000M of memory. It doesn't always use that much, but it might. With the full input loaded and processed, that much is not available. However, capping the amount it requests or will attempt to use at a lower amount that might be available when running still gives me the same error. I've also tried running with shell=True and same thing.</p>
  
  <p>This has been bugging me for a few days now. Thanks for any help.</p>
  
  <p>Edit: Expanding the traceback:</p>
  
  <pre><code>File "..../python2.6/subprocess.py", line 1037, in _execute_child
      self.pid=os.fork()
  OSError: [Errno 12] Cannot allocate memory
  </code></pre>
  
  <p>throws the error.</p>
  
  <p>Edit2: Running in python 2.6.4 on 64 bit ubuntu 10.4</p>