PySizer - a memory profiler for Python
PySizer is a memory usage profiler for Python code.
Downloading
You can get version 0.1.1 here.
There's a win32 build for Python 2.4 here.
0.1.1 has bugfixes to 0.1 - in particular, a nasty bug which meant
that copy and filterd were more or less broken. Also, it should work
under Python 2.3 (but it hasn't been tested much) and under Windows,
though I quietly put those two into 0.1 anyway.
The source is kept using Subversion at
http://codespeak.net/svn/user/nick8325/sizer,
and you can browse the source here too. The SVN head is
broken at the moment, though.
Features
- You can make a snapshot of all reachable objects at a given time,
organised as a tree (well, a graph, since there are cycles).
- For any given object, you can find out how much space it takes up, what
objects it references and so on.
With a patched version of Python, you can also find out what stack of
function calls created an object, and what objects were created by each
stack of calls.
- You can collect objects into groups. For example, you can group each
object according to the module it appears to come from. Then you can treat
the group as a single object.
- You can filter objects, find the amount of space used by instances of each
type, find objects which appeared from one snapshot to the next,
find the biggest objects/types/groups, and other things.
Requirements
See here.
Documentation
There's a tutorial here.
There's some automatically-generated documentation
here.
Both of these come with the release.
Bugs, feature requests, problems, anything else
You can contact me at nick.smallbone@gmail.com.