As I did a bit test, a python dict of int=>int (different value) of 30 million items can easily eats >2G memory on my mac. Since I work with only int to int dict, is there a
Another answer added if what you want is just an dictionary-like counter that's easy to use.
High performance Counter object from Python standard library