summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2020-02-19 13:34:21 +0000
committerErik Johnston <erik@matrix.org>2020-02-19 13:34:25 +0000
commitd830146bf86c667832fc5ecf2bcfcfedd0aee380 (patch)
tree31b43db6f39620c4265a2d970d9e210d3663c302
parentRevert `get_auth_chain_ids` changes (#6951) (diff)
downloadsynapse-d830146bf86c667832fc5ecf2bcfcfedd0aee380.tar.xz
Freeze allocated objects on startup.
This may make gc go a bit faster as the gc will know things like
caches/data stores etc. are frozen without having to check.
-rw-r--r--synapse/app/_base.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/synapse/app/_base.py b/synapse/app/_base.py
index 0e8b467a3e..46cf2fb098 100644
--- a/synapse/app/_base.py
+++ b/synapse/app/_base.py
@@ -279,6 +279,12 @@ def start(hs, listeners=None):
 
         setup_sentry(hs)
         setup_sdnotify(hs)
+
+        # 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()
     except Exception:
         traceback.print_exc(file=sys.stderr)
         reactor = hs.get_reactor()