summary refs log tree commit diff
path: root/synapse/util/caches/lrucache.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2021-04-26 10:29:26 +0100
committerErik Johnston <erik@matrix.org>2021-04-26 10:29:26 +0100
commit0c9bab290f921514532e73fdce6ef5d0b87222d7 (patch)
tree4a2e8890c520e70ce81b73f61a4d482e21658b8a /synapse/util/caches/lrucache.py
parentDon't have a global Asizer (diff)
downloadsynapse-0c9bab290f921514532e73fdce6ef5d0b87222d7.tar.xz
Ignore singletons
Diffstat (limited to 'synapse/util/caches/lrucache.py')
-rw-r--r--synapse/util/caches/lrucache.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/synapse/util/caches/lrucache.py b/synapse/util/caches/lrucache.py

index fdf3b726b0..b018733288 100644 --- a/synapse/util/caches/lrucache.py +++ b/synapse/util/caches/lrucache.py
@@ -44,6 +44,10 @@ try: recurse: If true will include referenced values in the size, otherwise only sizes the given object. """ + # Ignore singleton values when calculating memory usage. + if val in ((), None, ""): + return 0 + sizer = Asizer() sizer.exclude_refs((), None, "") return sizer.asizeof(val, limit=100 if recurse else 0)