We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 00f9fc0 commit ee23d0cCopy full SHA for ee23d0c
changelog.d/6953.misc
@@ -0,0 +1 @@
1
+Reduce time spent doing GC by freezing objects on startup.
synapse/app/_base.py
@@ -279,6 +279,15 @@ def handle_sighup(*args, **kwargs):
279
280
setup_sentry(hs)
281
setup_sdnotify(hs)
282
+
283
+ # We now freeze all allocated objects in the hopes that (almost)
284
+ # everything currently allocated are things that will be used for the
285
+ # rest of time. Doing so means less work each GC (hopefully).
286
+ #
287
+ # This only works on Python 3.7
288
+ if sys.version_info >= (3, 7):
289
+ gc.collect()
290
+ gc.freeze()
291
except Exception:
292
traceback.print_exc(file=sys.stderr)
293
reactor = hs.get_reactor()
0 commit comments