Вопрос

Possible Duplicate:
Is there any working memory profiler for Python3

I have some script where I'd like to find out which objects are using up the memory. Moreover it should be for Python 3. I've found some modules suggested for that, but they are often old and not coded for Python 3. Also trying to install all of them to try out is quite a hassle.

Do you know which memory profiler could give me the following statistics or maybe you know a manual Python hack I can program adhoc to examine the rather short script (not written by me and hence a mess :()?

I'd like to see the object count after the run and moreover in which line this object was created. That's all :)

Any ideas?

EDIT: One idea is to wrap all object instantiations by a class that counts the initialization in a class variable. It just would require to rewrite all instantiations of dicts, lists, etc.

Это было полезно?

Решение

I'm using objgraph which works with python3 without modifications.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top