multiprocessing.queue内存泄漏?

时间:2019-04-03 11:05:43

标签: python-multiprocessing

为什么示例py-multiprocessing代码内存泄漏?

python代码非常简单:

<div class="cursor" [style.top]="top" [style.left]="left" [ngClass]="{'expand':expand}"></div>

使用bash shell import multiprocessing from time import sleep import numpy as np def writer_proc(q): while True: if not q.full(): a = np.ones([768,768,3]) q.put(a, block = False) print q.qsize() else: sleep(1) def reader_proc(q): while True: if not q.empty(): q.get(block = False) else: sleep(1) if __name__ == "__main__": q = multiprocessing.Queue(2) writer = multiprocessing.Process(target=writer_proc, args=(q,)) writer.start() reader_proc(q) ,内存将很快增加。

0 个答案:

没有答案