Popular recipes by Andrew http://code.activestate.com/recipes/users/4185117/2013-02-02T12:09:23-08:00ActiveState Code RecipesAttempt to estimate a size of Python object (Python) 2013-02-02T12:09:23-08:00Andrewhttp://code.activestate.com/recipes/users/4185117/http://code.activestate.com/recipes/578447-attempt-to-estimate-a-size-of-python-object/ <p style="color: grey"> Python recipe 578447 by <a href="/recipes/users/4185117/">Andrew</a> (<a href="/recipes/tags/debug/">debug</a>). Revision 6. </p> <p>This function is built on assumption, that no custom types was implemented. Function traversing the tree of given object and summing sizes of pointers and basic-types objects got with sys.getsizeof() function. For example, for this two dicts {'key': 'shortstring'} and {'key': 'veryverylongandconsumingstring'} my function will return different sizes, while sys.getsizeof() will return same. TODO - make that calculation of size covers pointers of circular references which for now is just passed by</p>