How to use mmap in python when the whole file is too big
<p>I have a python script which read a file line by line and look if each line matches a regular expression.</p>

<p>I would like to improve the performance of that script by using memory map the file before I search. I have looked into mmap example: <a href="http://docs.python.org/2/library/mmap.html" rel="nofollow">http://docs.python.org/2/library/mmap.html</a></p>

<p>My question is how can I mmap a file when it is too big (15GB) for the memory of my machine (4GB)</p>

<p>I read the file like this:</p>

<pre><code>fi = open(log_file, 'r', buffering=10*1024*1024)

for line in fi: 
    //do somemthong

fi.close()
</code></pre>

<p>Since I set the buffer to 10MB, in terms of performance, is it the same as I mmap 10MB of file?</p>

<p>Thank you.</p>
