sys get memory usage of some object import sys dic = {'a': 3, 'b': 2, 'c': 1, 'd': 1} print(sys.getsizeof(dic))