在 jupyter notebook 中多次运行这个单元会导致内存泄漏。我不明白为什么。
my_list = list(map(lambda x: [1,2,3,4,4,4,4,4,4,4,4,4,4,4], range(300000)))
如果我运行以下单元格一次:
my_list = list(map(lambda x: [1,2,3,4,4,4,4,4,4,4,4,4,4,4], range(300000)))
my_list = list(map(lambda x: [1,2,3,4,4,4,4,4,4,4,4,4,4,4], range(300000)))
my_list = list(map(lambda x: [1,2,3,4,4,4,4,4,4,4,4,4,4,4], range(300000)))
my_list = list(map(lambda x: [1,2,3,4,4,4,4,4,4,4,4,4,4,4], range(300000)))
my_list = list(map(lambda x: [1,2,3,4,4,4,4,4,4,4,4,4,4,4], range(300000)))
my_list = list(map(lambda x: [1,2,3,4,4,4,4,4,4,4,4,4,4,4], range(300000)))
这样就不会出现内存泄漏了。所以我认为问题在于 jupyer notebook 如何管理单元格运行之间的引用和内存。
python3.7 Linux Mint 18.3