diff --git a/skluc/utils.py b/skluc/utils.py
index 525d7c972a90831fda5774a5f7d3065ee8b3e094..e9e93de739aca5ca33f4dfd99b9faed271922c75 100644
--- a/skluc/utils.py
+++ b/skluc/utils.py
@@ -214,6 +214,26 @@ def replace_nan(tensor):
     return np.where(np.isnan(tensor), np.zeros_like(tensor), tensor)
 
 
+def memory_usage():
+    """
+    Copy pasted from https://airbrake.io/blog/python-exception-handling/memoryerror
+
+    Prints current memory usage stats.
+    See: https://stackoverflow.com/a/15495136
+
+    :return: None
+    """
+    PROCESS = psutil.Process(os.getpid())
+    GIGA = 10 ** 9
+    # MEGA_STR = ' ' * MEGA
+
+    mem = psutil.virtual_memory()
+    total, available, used, free = mem.total / GIGA, mem.available / GIGA, mem.used / GIGA, mem.free / GIGA
+    proc = PROCESS.memory_info()[1] / GIGA
+    return 'process = %s total = %s available = %s used = %s free = %s' \
+          % (proc, total, available, used, free)
+
+
 def compute_euristic_sigma_chi2(dataset_full, slice_size=100):
     """
     Given a dataset, return the gamma that should be used (euristically) when using a rbf kernel on this dataset.