python有gc平时不用关心内存, 大量处理数据的时候,要优化内存占用得知道这个
代码:
http://pastebin.ubuntu.com/7690309/输出示例:
type basicsize itemsize mro
<type 'NoneType'> 16 0 (<type 'NoneType'>, <type 'object'>)
<type 'int'> 24 0 (<type 'int'>, <type 'object'>)
<type 'long'> 24 4 (<type 'long'>, <type 'object'>)
<type 'float'> 24 0 (<type 'float'>, <type 'object'>)
<type 'bool'> 24 0 (<type 'bool'>, <type 'int'>, <type 'object'>)
<type 'str'> 37 1 (<type 'str'>, <type 'basestring'>, <type 'object'>)
<type 'unicode'> 48 0 (<type 'unicode'>, <type 'basestring'>, <type 'object'>)
<type 'str'> 37 1 (<type 'str'>, <type 'basestring'>, <type 'object'>)
<type 'complex'> 32 0 (<type 'complex'>, <type 'object'>)
<type 'dict'> 248 0 (<type 'dict'>, <type 'object'>)
<type 'tuple'> 24 8 (<type 'tuple'>, <type 'object'>)
<type 'list'> 40 0 (<type 'list'>, <type 'object'>)
<type 'set'> 200 0 (<type 'set'>, <type 'object'>)
<type 'frozenset'> 200 0 (<type 'frozenset'>, <type 'object'>)
......