【发布时间】:2014-11-16 14:22:10
【问题描述】:
考虑这两个代码,我在 python 控制台中运行:
l=[]
for i in range(0,1000): l.append("."*1000000)
# if you check your taskmanager now, python is using nearly 900MB
del l
# now python3 immediately free-d the memory
现在考虑一下:
l=[]
for i in range(0,1000): l.append("."*1000000)
l.append(l)
# if you check your taskmanager now, python is using nearly 900MB
del l
# now python3 won't free the memory
由于我正在使用这些对象,并且我需要将它们从我的内存中释放出来,我需要知道为了让 python 识别它需要删除相应的内存。
PS:我使用的是Windows7。
【问题讨论】:
标签: python windows-7 garbage-collection python-3.4