summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2020-02-19 13:49:15 +0000
committerErik Johnston <erik@matrix.org>2020-02-19 13:49:15 +0000
commite377e08d5a4ae6d6b9a80799fe2d7c5fb9e19825 (patch)
tree0d76c098113dd48b691853dc560e292b32018111
parentNewsfile (diff)
downloadsynapse-github/erikj/gc_freeze_on_start.tar.xz
-rw-r--r--synapse/app/_base.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/synapse/app/_base.py b/synapse/app/_base.py
index 46cf2fb098..109b1e2fb5 100644
--- a/synapse/app/_base.py
+++ b/synapse/app/_base.py
@@ -282,9 +282,12 @@ def start(hs, listeners=None):
 
         # We now freeze all allocated objects in the hopes that (almost)
         # everything currently allocated are things that will be used for the
-        # rest of time. Doing so means less work each GC (hopefully)
-        gc.collect()
-        gc.freeze()
+        # rest of time. Doing so means less work each GC (hopefully).
+        #
+        # This only works on Python 3.7
+        if sys.version_info >= (3, 7):
+            gc.collect()
+            gc.freeze()
     except Exception:
         traceback.print_exc(file=sys.stderr)
         reactor = hs.get_reactor()