Decent way to trace resource leaks?

Cameron Laird claird at lairds.com
Tue Mar 23 17:00:02 EST 2004


In article <87r7vk7dnc.fsf at strauser.com>,
Kirk Strauser  <kirk at strauser.com> wrote:
			.
			.
			.
>I've written a fairly complex application [1] that runs under Windows XP
>with ActiveState Python.  I'm reasonably sure that I'm freeing all allocated
>resources, but my process seems grow slowly but steadily over time.  Worse,
>my network administrator seems to think that it's locking network resources
>and not freeing them, and while I don't *think* that's the case, I can't be
>certain.
>
>Ideally, I'd like to find a way to dump the process's object hierarchy to
>the screen or a file in a tree or graph format.  Even without variable
>names, it'd be tremendously helpful to see that there are 87 instances of
>Foo objects, each with 20 Bar objects as data members.  Although I'm running
>the application on Windows, I'm doing all development on a Linux system
>(using Subversion to synchronize source trees across machines, in case
>anyone is interested), so I'd prefer something native to Python and not a
>Windows-specific GUI debugger.
			.
			.
			.
This question interests me intensely--which is why I'm taking
so long to answer it.  I'd love to write a book on resource-
management techniques.

However, you need an answer now, and it probably won't serve
you even to wait for the well-crafted response I had in mind.
Let me put your progress in your own hands:  if you want "a
way to dump the process's object hierarchy", it's probably a
good time for you to read <URL:
http://python.org/doc/current/lib/module-inspect.html >.  Does
that give you what you need, for now?
-- 

Cameron Laird <claird at phaseit.net>
Business:  http://www.Phaseit.net



More information about the Python-list mailing list