From e29beec0b55e556fdeb1fe1777f558f7e5b76ec2 Mon Sep 17 00:00:00 2001 From: George Kalinin <146064808+ratatouille100@users.noreply.github.com> Date: Wed, 11 Jun 2025 15:18:55 +0300 Subject: [PATCH] fix: OutOfMemory --- dumpyara/utils/raw_image.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dumpyara/utils/raw_image.py b/dumpyara/utils/raw_image.py index cdc6b3e..5ea8dc5 100644 --- a/dumpyara/utils/raw_image.py +++ b/dumpyara/utils/raw_image.py @@ -47,9 +47,9 @@ def get_raw_image(partition: str, files_path: Path, output_image_path: Path): if lz4_image.is_file(): LOGI(f"Decompressing {lz4_image.name} as LZ4 image") - with LZ4FrameFile(lz4_image, mode="rb") as lz4_frame_file: - with io.open(raw_image, "wb") as raw_image: - raw_image.write(lz4_frame_file.read()) + with LZ4FrameFile(lz4_image, mode="rb") as lz4_frame_file, open(raw_image, "wb") as raw_image_file: + while chunk := lz4_frame_file.read(8 * 1024 * 1024): + raw_image_file.write(chunk) lz4_image.unlink()