Memory leak
examples/perf/mymem.py
import random def alloc(): a = { 'data': str(random.random()) + "a" * 10000000, } b = { 'data': str(random.random()) + "b" * 10000000, } a['other'] = b b['other'] = a
examples/perf/mem_leak.py
import sys from mymem import alloc if len(sys.argv) < 2: exit(f"Usage: {sys.argv[0]} N") count = int(sys.argv[1]) for _ in range(count): alloc() input("End the script")