dow*_*123 5 python garbage-collection memory-leaks memory-management
我应该在哪里调用垃圾收集器?调用函数后调用它会清除被调用函数的内存吗?
del另外,调用 gc.collect() 和专门对变量执行操作之间有什么区别
def a():
b()
# should I call gc.collect() here?
# is there any other way to release memory allocated in the called function here?
def b():
# big allocation like
foo = ['abc' for x in range(10**7)]
# should I call gc.collect() here?
# should I do a foo = None and x = None here?
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7102 次 |
| 最近记录: |