> sys.getsizeof() [a suggested solution] isn't platform-specific.

So, to answer the OP's question, you'd just do something like

def get_totalsize(obj):
        total_size = sys.getsizeof(obj)
        for value in vars(obj).values():
                try: total_size += get_total_size(value)
                except: total_size += sys.getsizeof(value)
        return totalSize

def get_current_size(env):
        size = 0
        for value in env.values():
                try: size += get_total_size(value)
                except: pass
        return size

get_current_size(vars())

and discount the weight of the interpreter?
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to