Python怎样清理占用的内存?【己解决】
[i=s] 本帖最后由 keshun 于 2021-11-5 10:42 编辑 [/i][code]import matplotlib.pyplot as plt
def aa():
plt.figure(figsize=(50, 20), dpi=300)
plt.savefig('1.jpg')
plt.clf() ; plt.close('all')
aa()
input("关闭窗口")[/code]代码循环运行,matplotlib模块aa()只开始运行一次,占用几百兆内存不能释放,请教高手怎样清理占用的内存? [i=s] 本帖最后由 keshun 于 2021-11-6 00:52 编辑 [/i]
[quote]http://www.bathome.net/thread-23875-1-1.html[/quote][code]if os.path.exists(r'empty.exe'): subprocess.Popen('empty *',stdout = subprocess.PIPE)
else: print(' 内存清理失败!缺少[empty.exe]')[/code]
页:
[1]