Using Concurrent Futures without running out of RAM

后端 未结 2 1357
礼貌的吻别
礼貌的吻别 2021-02-04 13:25

I\'m doing some file parsing that is a CPU bound task. No matter how many files I throw at the process it uses no more than about 50MB of RAM. The task is parrallelisable, and I

2条回答
  •  执念已碎
    2021-02-04 13:52

    you can try add del to your code like this

    for job in futures.as_completed(jobs):
        del jobs[job]
        del job #or job._result = None
    

提交回复
热议问题