title: Python process killed
body: <p>I am running the following code and I receive a 'killed' message from python:</p>
  
  <pre><code>import random,string
  
  def rotations(t):
          ''' Return list of rotations of input string t '''
          tt = t * 2
          return [ tt[i:i+len(t)] for i in xrange(0, len(t)) ]
  def bwtViaBwm(t):
          return ''.join(map(lambda x: x[-1], bwm(t)))
  def bwm(t):
          return sorted(rotations(t))
  
  def build_FM(fname):
          stream=readfile(fname)
          fc=[x[0] for x in bwtViaBwm(stream)]
  
  
  def readfile(sd):
      s=""
      with open(sd,'r') as myfile:
          s =myfile.read()
      return s.rstrip('\n')
  
  def writefile(sd,N):
          with open(sd, "wb") as sink:
              sink.write(''.join(random.choice(string.ascii_uppercase + string.digits) for _ in xrange(int(N))))
              sink.write('$')
          return
  def main():
      fname= sys.argv[1]
      N =sys.argv[2]
      writefile(fname,N)
      build_FM(fname)
      return
  
  if __name__=='__main__':
          main()
  </code></pre>
  
  <p>It takes as input a file name and a number. The code creates a random stream of size <code>N</code> and then runs the BWT transformation on that stream. When I give as input <code>N=500000</code>, I am getting a 'killed' message, which seems a small number for memory error. My system runs Ubuntu 14.04, 8GB RAM and python 2.7.</p>
  
  <p>This is how i run the script:</p>
  
  <pre><code>python  fm.py new_file.csv 500000
  </code></pre>
  
  <p>and i am getting this after some seconds:</p>
  
  <pre><code>killed
  </code></pre>