Skip to content

Commit

Permalink
Try manual garbage collection to avoid memory leaks (#316)
Browse files Browse the repository at this point in the history
  • Loading branch information
hf-kklein committed May 20, 2024
1 parent 448ccda commit 545f929
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/kohlrahbi/ahb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""

import fnmatch
import gc
import re
from datetime import date
from pathlib import Path
Expand Down Expand Up @@ -60,6 +61,7 @@ def process_ahb_table(
unfolded_ahb.dump_flatahb_json(output_path)
if AhbExportFileFormat.CSV in file_type:
unfolded_ahb.dump_csv(output_path)
del unfolded_ahb


# pylint:disable=anomalous-backslash-in-string
Expand Down Expand Up @@ -115,6 +117,10 @@ def process_pruefi(
return

process_ahb_table(ahb_table, pruefi, output_path, file_type)
del ahb_table.table
del ahb_table
del doc
gc.collect()


def get_ahb_documents_path(base_path: Path, version: str) -> Path:
Expand Down

0 comments on commit 545f929

Please sign in to comment.