On Mon, Dec 12, 2011 at 08:25:31AM -0800, writeson wrote:
> I've got a pylons application that's got a memory leak, I think from
> Ajax/JSON calls coming from the application JavaScript. How do I go
> about debugging/finding this problem?

First it would help if you could determine if the leaked memory belongs
to Python objects, or a C library of some kind.

E.g. try graphing len(gc.get_objects()) over time.  If the number keeps
growing, you've got a, let's call it, Type A leak.  I've developed a
Python module (http://pypi.python.org/pypi/objgraph) to help me deal
with these:

  http://mg.pov.lt/objgraph/#memory-leak-example

which is the distilled essence (with some improvements) of the original
three-part story:

  http://mg.pov.lt/blog/hunting-python-memleaks.html
  http://mg.pov.lt/blog/python-object-graphs.html
  http://mg.pov.lt/blog/object-graphs-with-graphviz.html


Regarding Type B leaks (unfreed C code allocations), I'm afraid I'm less
familiar with the problem.  Try Valgrind?

Regards,
Marius Gedminas
-- 
We're sysadmins. To us, data is a protocol-overhead.

Attachment: signature.asc
Description: Digital signature

Reply via email to