Thread Profiling

Chris Mellon arkanes at gmail.com
Mon Nov 5 18:09:59 EST 2007


On Nov 5, 2007 1:32 PM, JamesHoward <James.w.Howard at gmail.com> wrote:
> Are there any good thread profilers available that can profile a
> thread as it is running instead of after execution is completed?
>
> I would like to find a python class which looks at a currently running
> thread and if its memory exceeds a certain amount than kill it.

Killing a non-cooperative thread is undefined behavior. You can't do
it with the Python threading API and even OS thread implementations
that permit it don't guarantee that your process will be in a sane
state afterward.

> Ideally I would like the program to track memory used not just by that
> thread, but by any threads or processes that it may spawn.
>
> If there isn't anything like that, then something that lets me set the
> maximum memory allowed to be allocated within a thread would be
> acceptable also.
>

Memory isn't allocated on a per-thread basis and there's not really
any way to know what should be charged to a particular thread. That's
on top of the normal caveats about trying to judge memory usage within
Python


> Thanks in advance,
> James Howard
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>



More information about the Python-list mailing list