title: Big CSV to pickled dict
body: <p>I have a 1 GB CSV file like this (<code>16-char-max-string;int</code>)</p>
  
  <pre><code>hello;1798732      
  you;1762
  ...
  </code></pre>
  
  <p>that is slow to be parsed into a <code>dict</code>, that's why I would like to <strong>do it once, save it as pickled file</strong> (or any other serialization method), and then reopen this already-processed file for further use.</p>
  
  <p>I tried:</p>
  
  <pre><code>import csv, time
  import cPickle as pickle
  
  d = dict()
  
  start = time.time()
  
  with open('mycsv.csv', mode='r') as f:
      reader = csv.reader(f, delimiter=';')
      for r in reader:
          d[r[0]] = int(r[1])
  
  print time.time() - start
  
  with open('mydict', 'wb') as f:
      pickle.dump(d, f)
  </code></pre>
  
  <p>but it doesn't really work: I'm using Python 64 bit to do it, but I see memory usage during the process explodes to more than 4 GB! (and then more, and it nearly crashed my computer).</p>
  
  <p><strong>How to parse this CSV file into a serialized <code>dict</code> in a more RAM-economic way?</strong></p>