From d9fe273ff33c6f158fc3d6be7407d2fa1a9691b9 Mon Sep 17 00:00:00 2001
From: David Hendriks <davidhendriks93@gmail.com>
Date: Sat, 12 Jun 2021 20:29:05 +0100
Subject: [PATCH] added some garbage collecting

---
 binarycpython/utils/distribution_functions.py | 3 +++
 binarycpython/utils/grid.py                   | 2 ++
 2 files changed, 5 insertions(+)

diff --git a/binarycpython/utils/distribution_functions.py b/binarycpython/utils/distribution_functions.py
index a8d2f90cc..eaa00396f 100644
--- a/binarycpython/utils/distribution_functions.py
+++ b/binarycpython/utils/distribution_functions.py
@@ -20,6 +20,7 @@ Tasks:
     - TODO: make an n-part powerlaw thats general enough to fix the three part and the 4 part
 """
 
+import gc
 import math
 import json
 
@@ -1256,6 +1257,8 @@ def build_q_table(options, m, p, verbosity=0):
                     _MS_VERBOSITY_LEVEL,
                 )
                 Moecache["rinterpolator_q_given_{}_log10{}".format(m, p)].destroy()
+                gc.collect()
+
 
     #
     if not incache:
diff --git a/binarycpython/utils/grid.py b/binarycpython/utils/grid.py
index 4fb491b24..938b0ba58 100644
--- a/binarycpython/utils/grid.py
+++ b/binarycpython/utils/grid.py
@@ -25,6 +25,7 @@ Tasks:
 """
 
 import os
+import gc
 import sys
 import copy
 import json
@@ -3817,3 +3818,4 @@ eccentricity3=0
         for key in interpolator_keys:
             Moecache[key].destroy()
             del Moecache[key]
+        gc.collect()
-- 
GitLab