You want to determine which code block or object
is using a lot of memory.
I looked it up on Google and found that Python Memory Validator,
for paid versionsAs an open source, PySizer Heapy came out
Please recommend a memory profiler to use among these
The functionality I need is
This is.
performance python memory-management profiling
How about Heapy?
If it's a simple case, you just need to add 3 lines (of course, it could be longer, right?)
from guppy import hpy
h = hpy()
print h.heap()
The results are as follows
Partition of a set of 132527 objects. Total size = 8301532 bytes.
Index Count % Size % Cumulative % Kind (class / dict of class)
0 35144 27 2140412 26 2140412 26 str
1 38397 29 1309020 16 3449432 42 tuple
2 530 0 739856 9 4189288 50 dict (no owner)
Installation is as follows
pip install guppy
© 2024 OneMinuteCode. All rights reserved.