second = 'def' * 1000
my_dictionary = {'first': first, 'second': second}
getsizeof(first)
getsizeof(second)
getsizeof(my_dictionary)
getsizeof(json.dumps(my_dictionary))
size = getsizeof(my_dictionary)
size += sum(map(getsizeof, list(my_dictionary.values()))) + sum(map(getsizeof,
    list(my_dictionary.keys())))
size
Использование памяти словаря в Python?