mirror of
https://github.com/element-hq/synapse
synced 2024-06-30 18:23:28 +00:00
Ignore singletons
This commit is contained in:
parent
5003bd29d2
commit
0c9bab290f
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue