Skip to content
Snippets Groups Projects
Commit 35427b65 authored by Piotr Maślanka's avatar Piotr Maślanka
Browse files

Merge branch 'master' into develop

parents 1226e972 f2ee6380
No related branches found
No related tags found
No related merge requests found
......@@ -13,13 +13,18 @@ def dump_memory_on(output: tp.TextIO = sys.stderr):
Make sure you have enough memory to generate a breakdown. You can preallocate something at the
start for example.
.. warning:: This will return size of 0 on PyPy
:param output: output, default is stderr
"""
top_scores = {}
instances = {}
for obj in gc.get_objects():
typ = type(obj)
size = sys.getsizeof(obj)
try:
size = sys.getsizeof(obj)
except TypeError:
size = 0
if typ in top_scores:
top_scores[typ] += size
instances[typ] += 1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment