From 80f9330cb41dfbbf9a1b061305d039b587304ada Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Wed, 12 Feb 2020 19:33:16 -0800 Subject: [PATCH] Use while and pop so that finished chunks can be garbaged. Keeps memory usage stable instead of infinitely growing! --- pixelcanvas.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pixelcanvas.py b/pixelcanvas.py index fa67112..95aa9e3 100644 --- a/pixelcanvas.py +++ b/pixelcanvas.py @@ -191,7 +191,9 @@ def download_bigchunk_range(bigchunk_xy1, bigchunk_xy2, threads=1): for (x, y) in bigchunks ] jobs = pool.add_many(kwargss) + while jobs: for job in jobs: + job = jobs.pop(0) job.join() if job.exception: raise job.exception