title: list append memory error
body: <p>I have <code>.txt</code> files, each of them consists one very long line, the program stops at the line <code>b.append(int(j))</code> throwing a memory error. I don't understand why the program is giving a memory error because the file is of 2.8 MB and my RAM size is 28GB. </p>
  
  <pre><code>if __name__=='__main__':
      path=raw_input("enter file path:")
      image_path=raw_input("enter directory where images are to be stored:")
      count = 0
      for f in sorted(os.listdir(path)):
          print(f)
          file = path+'/'+f
          b = []
          a =[]
          ref =[]
          alt = []
  
          if (f[:-4] == '0'):
              print('cb1')
              ch = open(file,'r')
              for i in ch:
                  b += i.split()
              for j in b:
                  b.append(int(j))
              count+=1
              print('cb2')
  
          elif (f[:-4] == '1'):
              po = open(file,'r')
              for i in po:
                  a += i.split()
              for j in a:
                  a.append(int(j))
              count+=1
  
          elif (f[:-4] == '3'):
              re = open(file,'r')
              for i in re:
                  ref += i.split()
              count+=1
  
          elif (f[:-4] == '4'):
              al = open(file,'r')
              for i in al:
                  alt += i.split()
              count+=1
          if (count == 4):
              break
  
  
      cnt = 0
      for f in sorted(os.listdir(path)):
          print(f)
          file = path+'/'+f
          cnt += 1
          if cnt&gt;4:
              process(path+'/'+f, image_path , f)
  
      ch.close()
      po.close()
      re.close()
      al.close()
  </code></pre>
  
  <p>I'm using python 2.7 64bit on ubuntu 16.04 with 28 GB RAM. The 0.txt can be downloaded from <a href="https://drive.google.com/file/d/13iIYLGnlfGUgi96myRy9gc8YVOrLn4G2/view?usp=sharing" rel="nofollow noreferrer">here</a></p>