title: Optimization of memory usage while copying buffers in python
body: <p>I have to copy and do some simple processing on file. I can not read whole file to the memory because it is to big. I come up with piece of code which looks like this:</p>
  
  <pre><code>buffer = inFile.read(buffer_size)
  while len(buffer) &gt; 0:
      outFile.write(buffer)
      simpleCalculations(buffer)
      buffer = inFile.read(buffer_size)
  </code></pre>
  
  <p>simpleCalculations procedure is irrelevant in this context but I am worried about subsequent memory allocations of buffer list. On some hardware configuration memory usage gets very high and that apparently kills the machine. I would like to reuse buffer. Is this posible in python 2.6?</p>