mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-12-11 11:34:23 -05:00
Don't disable GC when running on PyPy
PyPy's incminimark GC can't be triggered manually. From what I observed there are no obvious issues with just letting it run normally. And unlike CPython, it actually returns unused RAM to the system. Signed-off-by: Vincent Breitmoser <look@my.amazin.horse>
This commit is contained in:
parent
f4284d943a
commit
6d7f0f8dd3
@ -17,6 +17,7 @@ import logging
|
|||||||
import functools
|
import functools
|
||||||
import time
|
import time
|
||||||
import gc
|
import gc
|
||||||
|
import platform
|
||||||
|
|
||||||
from twisted.internet import reactor
|
from twisted.internet import reactor
|
||||||
|
|
||||||
@ -30,6 +31,7 @@ from .process_collector import register_process_collector
|
|||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
running_on_pypy = platform.python_implementation() == 'PyPy'
|
||||||
all_metrics = []
|
all_metrics = []
|
||||||
all_collectors = []
|
all_collectors = []
|
||||||
|
|
||||||
@ -174,6 +176,9 @@ def runUntilCurrentTimer(func):
|
|||||||
tick_time.inc_by(end - start)
|
tick_time.inc_by(end - start)
|
||||||
pending_calls_metric.inc_by(num_pending)
|
pending_calls_metric.inc_by(num_pending)
|
||||||
|
|
||||||
|
if running_on_pypy:
|
||||||
|
return ret
|
||||||
|
|
||||||
# Check if we need to do a manual GC (since its been disabled), and do
|
# Check if we need to do a manual GC (since its been disabled), and do
|
||||||
# one if necessary.
|
# one if necessary.
|
||||||
threshold = gc.get_threshold()
|
threshold = gc.get_threshold()
|
||||||
@ -206,6 +211,7 @@ try:
|
|||||||
|
|
||||||
# We manually run the GC each reactor tick so that we can get some metrics
|
# We manually run the GC each reactor tick so that we can get some metrics
|
||||||
# about time spent doing GC,
|
# about time spent doing GC,
|
||||||
gc.disable()
|
if not running_on_pypy:
|
||||||
|
gc.disable()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
pass
|
pass
|
||||||
|
Loading…
Reference in New Issue
Block a user