1

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.

Community
  • 1
  • 1
Gere
  • 12,075
  • 18
  • 62
  • 94

1 Answers1

1

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

Scharron
  • 17,233
  • 6
  • 44
  • 63
  • Hmm, I'd rather have counts, because I know a have a lot of objects. Just some of them created in one particular line start to consume to much memory. – Gere Jun 22 '12 at 15:49
  • I don't know anything else, just thrown you what I know. However, watching the code, I was able to hack and add some funs to report additional stats about memory usage, but it was some time ago. Sorry :-) – Scharron Jun 22 '12 at 16:11