我正在开发一个应用程序,可以读取视频,将其转换为图像,然后成对处理。由于应用程序将运行在一个覆盆子Pi上,内存没有多少可用的RAM。在
如果我在一个简单的for循环中运行任务,而不使用Executor内存,那么它的性能会很好,但是如果我使用Executor调度50个作业,内存会停留在800Mb左右,而块永远不会释放。问题代码如下:executor = ThreadPoolExecutor(max workers = 1)
future_list = []
#Read converted images from directory(around 100 images in gray scale)
images = imread_collection(image_directory)
for i in range(0,len(images)-1,2):
img1 = images[i][:,:,0]
img2 = images[i+1][:,:,0]
future = executor.submit(process,xStart,yStart,xLen,yLen,img1,img2,i)
future_list.append(future)
#Wait or all tasks to finish
executor.shutdown(wait=True)
在将代码发送到
覆盆子。此问题在Linux中存在,但在Mac中不存在。在