4

If I have a nested dictionary, then the size of the cPickle'd file is much smaller than the memory used by the python process when I load it into memory. (I am referring to the Memory column in Windows 7 task manager.)

For example, one file of 28MB seems to turn into 202MB of memory. Another file of 155MB takes 1.50GB in memory.

Any pointers on why this is happening, and how I can reduce this inflation?

These nested dictionary contains only integer keys, and values are either integers or other nested integer dictionaries.

4

1 回答 1

1

您可以考虑objgraph尝试一下:它允许您检查程序内存中发生的情况;它也可以生成视觉输出。

有关详细信息,请参阅http://mg.pov.lt/objgraph/

于 2013-08-24T11:22:59.727 回答