From 24317a510e48a72249b515125928ce1ac93acf23 Mon Sep 17 00:00:00 2001 From: KASR Date: Thu, 27 Apr 2023 16:51:52 +0200 Subject: [PATCH] minor improvment small change so that the available ram is checked and not the total ram --- scripts/verify-checksum-models.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/verify-checksum-models.py b/scripts/verify-checksum-models.py index 2aa77c415..f994a4edb 100644 --- a/scripts/verify-checksum-models.py +++ b/scripts/verify-checksum-models.py @@ -3,11 +3,11 @@ import hashlib import psutil def sha256sum(file): - # Check if system has enough RAM to read the file at once + # Check if system has enough free RAM to read the file at once file_size = os.path.getsize(file) - total_memory = psutil.virtual_memory().total + available_memory = psutil.virtual_memory().available - if file_size < total_memory: + if file_size < available_memory: # Read the file at once with open(file, "rb") as f: file_hash = hashlib.sha256(f.read())