By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,908 Members | 2,041 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,908 IT Pros & Developers. It's quick & easy.

Memory profiling

P: n/a
I have a fairly large program that uses a number of third-party
modules. After a few hours the program eats several 100M of memory.

Does Python provide any tools that can help in determining where the
memory is used? Ideally, I would like to see a tool that can list all
objects by memory-usage, but any tool that can return the number of
bytes used by an arbitrary object would be of great help. Even
something that could find all allocated dicts&lists and return their
size+name would help.

Regards,
--
Rune Frøysa
University of Oslo, Norway
Jul 18 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Rune Froysa <ru*********@usit.uio.no> writes:
Does Python provide any tools that can help in determining where the
memory is used?
*Memory*, no. Especially in a debug build, there are tools for
finding out where the objects are, though.
Ideally, I would like to see a tool that can list all objects by
memory-usage, but any tool that can return the number of bytes used
by an arbitrary object would be of great help. Even something that
could find all allocated dicts&lists and return their size+name
would help.


In a debug build, look at sys.getobjects. In a recent release build,
look at gc.get_objects.

Cheers,
mwh

--
<arigo> something happens, what I'm not exactly sure.
-- PyPy debugging fun
Jul 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.