diff --git a/binarycpython/utils/distribution_functions.py b/binarycpython/utils/distribution_functions.py
index a8d2f90ccffd827ff38366e61337bb91c969540c..eaa00396f73cb227e7e3de74aa00436649c932d8 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 4fb491b249d588badfbe996ed307952eef62c424..938b0ba58ac5cc20927a27e63b15681f66a0d89b 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()