On Wed, 22 Apr 2009 02:30:32 -0700, Chris Rebert wrote: > On Wed, Apr 22, 2009 at 2:24 AM, BlueBird <p...@freehackers.org> wrote: >> >> Hi, >> >> I have a program that manages several thousands instances of one >> object. To reduce memory >> consumption, I want of course that specific object to have the smallest >> memory footpring possible. >> >> I have a few ideas that I want to experiment with, like using >> __slots__, using a tuple or using a dict. My question is: how do I know >> the memory footprint of a given python object ? I could not find any >> builtin functions for this in the documentation. > > sys.getsizeof() - http://docs.python.org/library/sys.html#sys.getsizeof
Only in Python 2.6. But if you search Activestate, there's a recipe to do the same thing. Ah, here it is: http://code.activestate.com/recipes/546530/ -- Steven -- http://mail.python.org/mailman/listinfo/python-list