From 8437c1f60e8da0839ee93a59650b4d1987b8ef2e Mon Sep 17 00:00:00 2001 From: Leo Vasanko Date: Tue, 21 Nov 2023 12:23:24 +0000 Subject: [PATCH] Attempt to reduce leak of ffmpeg previews --- cista/preview.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cista/preview.py b/cista/preview.py index cb541e3..0a82d2e 100644 --- a/cista/preview.py +++ b/cista/preview.py @@ -1,4 +1,5 @@ import asyncio +import gc import io import mimetypes import urllib.parse @@ -109,5 +110,7 @@ def process_video(path, *, maxsize, quality): img = img.rotate(rot, expand=True) img.save(imgdata, format="webp", quality=quality, method=4) del img - - return imgdata.getvalue() + ret = imgdata.getvalue() + del imgdata + gc.collect() + return ret