Open
Description
Hi everyone !
I'd like to accurately estimate the size in ram of objects from the python-docx lib.
I've tried sys.getsizeof() which doesn't work very well. In fact, the object I'm interested in : docx.text.run.Run is just a proxy. So this approach doesn't work.
I also tried pympler.asizeof
but I have this rather complicated error to understand :
File "/usr/app/src/annotation/colorization/heuristics/content_awareness.py", line 132, in deep_copy
print(f"adding {asizeof(obj)} bytes to memory. Object: {obj}")
File "/usr/local/lib/python3.10/dist-packages/pympler/asizeof.py", line 2545, in asizeof
s = _asizer.asizeof(*t)
File "/usr/local/lib/python3.10/dist-packages/pympler/asizeof.py", line 1954, in asizeof
return sum(self._sizer(o, 0, 0, None) for o in objs)
File "/usr/local/lib/python3.10/dist-packages/pympler/asizeof.py", line 1954, in <genexpr>
return sum(self._sizer(o, 0, 0, None) for o in objs)
File "/usr/local/lib/python3.10/dist-packages/pympler/asizeof.py", line 1888, in _sizer
s += z(o, i, d, None)
File "/usr/local/lib/python3.10/dist-packages/pympler/asizeof.py", line 1888, in _sizer
s += z(o, i, d, None)
File "/usr/local/lib/python3.10/dist-packages/pympler/asizeof.py", line 1888, in _sizer
s += z(o, i, d, None)
[Previous line repeated 13 more times]
File "/usr/local/lib/python3.10/dist-packages/pympler/asizeof.py", line 1887, in _sizer
for o in v.refs(obj, False):
File "/usr/local/lib/python3.10/dist-packages/pympler/asizeof.py", line 571, in _refs
if hasattr(obj, a):
TypeError: descriptor '__dict__' for '_OxmlElementBase' objects doesn't apply to a 'CT_CoreProperties' object
I'm very curious to know if anyone has any ideas for solving this problem!
Metadata
Metadata
Assignees
Labels
No labels