Hi,
I use the following code to get some stats about memory usage:
objs = gc.get_objects( )
classes = len([obj for obj in objs if inspect.isclass (obj)])
functions = len([obj for obj in objs if inspect.isrouti ne(obj)])
modules = len([obj for obj in objs if inspect.ismodul e(obj)])
dicts = len([obj for obj in objs if type(obj) == types.DictType])
lists = len([obj for obj in objs if type(obj) == types.ListType])
tuples = len([obj for obj in objs if type(obj) == types.TupleType])
For a simple program, which just prints values of a dict object, I get the following:
Objects: 2920
Modules: 36
Classes: 74
Functions: 1057
Dictionaries: 193
Lists: 49
Tuples: 1419
Are there that many objects/functions/etc. used by my simple program? How? Why?
Thanks.
I use the following code to get some stats about memory usage:
objs = gc.get_objects( )
classes = len([obj for obj in objs if inspect.isclass (obj)])
functions = len([obj for obj in objs if inspect.isrouti ne(obj)])
modules = len([obj for obj in objs if inspect.ismodul e(obj)])
dicts = len([obj for obj in objs if type(obj) == types.DictType])
lists = len([obj for obj in objs if type(obj) == types.ListType])
tuples = len([obj for obj in objs if type(obj) == types.TupleType])
For a simple program, which just prints values of a dict object, I get the following:
Objects: 2920
Modules: 36
Classes: 74
Functions: 1057
Dictionaries: 193
Lists: 49
Tuples: 1419
Are there that many objects/functions/etc. used by my simple program? How? Why?
Thanks.