title: Python's mmap() performance down with time
body: <p>I am wondering why Python's <em>mmap()</em> performance going down with time? I mean I have a little app which make changes to N files, if set is big <em>(not too really big, say 1000)</em> first 200 is demon-speed but after that it goes slower and slower. It looks like I should free memory once in a while but don't know how and most importantly why Python do not do this automagically.</p>
  
  <p>Any help?</p>
  
  <p>-- edit --</p>
  
  <p>It's something like that:</p>
  
  <pre><code>def function(filename, N):
     fd = open(filename, 'rb+')
     size = os.path.getsize(filename)
     mapped = mmap(fd.fileno(), size)
  
     for i in range(N):
        some_operations_on_mmaped_block()
  
     mapped.close()
  </code></pre>