Explicit triggering garbage collection
import argparse
import binascii
+import gc
import multiprocessing
import os
import platform
@@ -939,7 +940,7 @@ def run_installer(archives: List[QtPackage], base_dir: str, sevenzip: Optional[s
tasks.append((arc, base_dir, sevenzip, queue, archive_dest, keep))
ctx = multiprocessing.get_context("spawn")
if is_64bit():
- pool = ctx.Pool(Settings.concurrency, init_worker_sh)
+ pool = ctx.Pool(Settings.concurrency, init_worker_sh, (), 4)
else:
pool = ctx.Pool(Settings.concurrency, init_worker_sh, (), 1)
@@ -1026,6 +1027,7 @@ def installer(
num_retries=Settings.max_retries_on_checksum_error,
name=f"Downloading {name}",
)
+ gc.collect()
if command is None:
with py7zr.SevenZipFile(archive, "r") as szf:
szf.extractall(path=base_dir)
@@ -1051,6 +1053,7 @@ def installer(
if not keep:
os.unlink(archive)
logger.info("Finished installation of {} in {:.8f}".format(archive.name, time.perf_counter() - start_time))
+ gc.collect()
qh.flush()
qh.close()
logger.removeHandler(qh)
