Re: How do I begin debugging a python memory leak?

2009-09-18 Thread Chris Withers

Matthew Wilson wrote:

I have a web app based on TurboGears 1.0.  In the last few days, as
traffic and usage has picked up, I noticed that the app went from using
4% of my total memory all the way up to 50%.

I suspect I'm loading data from the database and somehow preventing
garbage collection.

Are there any tools that might help me out with this?


http://pypi.python.org/pypi/guppy

...which will give you:

http://guppy-pe.sourceforge.net/heapy_tutorial.html

Good for finding out what's making up the memory usage.

cheers,

Chris

--
Simplistix - Content Management, Batch Processing  Python Consulting
   - http://www.simplistix.co.uk
--
http://mail.python.org/mailman/listinfo/python-list


Re: How do I begin debugging a python memory leak?

2009-09-18 Thread Rainer Grimm
On 17 Sep., 02:10, Matthew Wilson m...@tplus1.com wrote:
 I have a web app based on TurboGears 1.0.  In the last few days, as
 traffic and usage has picked up, I noticed that the app went from using
 4% of my total memory all the way up to 50%.

 I suspect I'm loading data from the database and somehow preventing
 garbage collection.

 Are there any tools that might help me out with this?

If have one of the following plattforms
X86/Linux, AMD64/Linux, PPC32/Linux, PPC64/Linux and X86/Darwin (Mac
OS X),
have a look at valgrind.
http://valgrind.org/
I used of often for searching the memory leaks in c++. It's a great
tool to analyse your memory behaviour.

Greetings
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How do I begin debugging a python memory leak?

2009-09-18 Thread Paul Rubin
Rainer Grimm r.gr...@science-computing.de writes:
 have a look at valgrind.

Have you actually used that on Python?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How do I begin debugging a python memory leak?

2009-09-18 Thread Rainer Grimm
On Sep 18, 5:42 pm, Paul Rubin http://phr...@nospam.invalid wrote:
 Rainer Grimm r.gr...@science-computing.de writes:
  have a look at valgrind.

 Have you actually used that on Python?
Not with python as far I can remember. But often with C++ executables,
as i mentioned it.
I you look at
http://valgrind.org/info/
there stands:
Valgrind has been used on programs written partly or entirely in C, C+
+, Java, Perl, Python, assembly code, Fortran, Ada, and many others.

It exists also a extension for python
http://blogs.gnome.org/jamesh/2008/03/24/python-valgrind/ , to get rid
of the false positiv errors.
So it should be worth a try.
-- 
http://mail.python.org/mailman/listinfo/python-list


How do I begin debugging a python memory leak?

2009-09-16 Thread Matthew Wilson
I have a web app based on TurboGears 1.0.  In the last few days, as
traffic and usage has picked up, I noticed that the app went from using
4% of my total memory all the way up to 50%.

I suspect I'm loading data from the database and somehow preventing
garbage collection.

Are there any tools that might help me out with this?



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How do I begin debugging a python memory leak?

2009-09-16 Thread Diez B. Roggisch

Matthew Wilson schrieb:

I have a web app based on TurboGears 1.0.  In the last few days, as
traffic and usage has picked up, I noticed that the app went from using
4% of my total memory all the way up to 50%.

I suspect I'm loading data from the database and somehow preventing
garbage collection.

Are there any tools that might help me out with this?


Maybe this one:

 http://packages.python.org/Pympler/

Haven't used it myself so far though. I also have good experiences with 
using the module gc  calculating histograms of instance-counts.


Diez
--
http://mail.python.org/mailman/listinfo/python-list


Re: How do I begin debugging a python memory leak?

2009-09-16 Thread Andrew Svetlov
guppy-pe
On Sep 16, 8:10 pm, Matthew Wilson m...@tplus1.com wrote:
 I have a web app based on TurboGears 1.0.  In the last few days, as
 traffic and usage has picked up, I noticed that the app went from using
 4% of my total memory all the way up to 50%.

 I suspect I'm loading data from the database and somehow preventing
 garbage collection.

 Are there any tools that might help me out with this?

-- 
http://mail.python.org/mailman/listinfo/python-list