Fix potential memory leak for cache ram
parent
5cdad8922c
commit
0aa846a837
|
@ -688,7 +688,8 @@ class LoadImagesAndLabels(Dataset):
|
|||
b, gb = 0, 1 << 30 # bytes of cached images, bytes per gigabytes
|
||||
self.im_hw0, self.im_hw = [None] * n, [None] * n
|
||||
fcn = self.cache_images_to_disk if cache_images == "disk" else self.load_image
|
||||
results = ThreadPool(NUM_THREADS).imap(lambda i: (i, fcn(i)), self.indices)
|
||||
with ThreadPool(NUM_THREADS) as pool:
|
||||
results = pool.imap(lambda i: (i, fcn(i)), self.indices)
|
||||
pbar = tqdm(results, total=len(self.indices), bar_format=TQDM_BAR_FORMAT, disable=LOCAL_RANK > 0)
|
||||
for i, x in pbar:
|
||||
if cache_images == "disk":
|
||||
|
|
Loading…
Reference in New Issue