understanding python memory allocation and free up
问题 I recently came across this article about python memory allocation. In this page it describes the memory usage of python and in there there is an example showing deepcopy of list of integers. I did the benchmark myself on Python 2.7 Line # Mem usage Increment Line Contents ================================================ 4 28.051 MiB 0.000 MiB @profile 5 def function(): 6 59.098 MiB 31.047 MiB x = list(range(1000000)) # allocate a big list 7 107.273 MiB 48.176 MiB y = copy.deepcopy(x) 8 99