Detecting memory leaks on apache, mod_python

Steven D'Aprano steve at REMOVE-THIS-cybersource.com.au
Fri Dec 21 23:51:43 EST 2007


On Fri, 21 Dec 2007 14:21:27 +0100, Diez B. Roggisch wrote:

>>> So, anyone who hit's on this thread via a search will think
>>>
>>> a) that there's really no memory leak detection for python b) that
>>> this community is not very helpful
> 
> c) That finally people in this forum are smart enough to detect your
> flamebait & refuse to comment on it, Ilias...

Not me. I didn't (still don't actually) recognise Ilias' name. I was 
actually thinking:

(d) Python is so great that there can never be any memory leaks!

but I guess that's probably wishful thinking.

So... how do you measure memory usage in Python? Every programming 
language I've used before (not a huge range, I'll admit) had *some* sort 
of facility to measure memory usage, typically things like:

* how much memory is free in the stack?

* how much memory is free in the heap?

* how big a block does this pointer point to?

* how much memory does this record/struct/object/string use?

Unless I've missed something, I don't believe Python does *any* of that. 
It could be quite useful. The timeit module is good for measuring the 
time taken for code to run, but as near as I can tell, there's no way to 
optimize memory use except prematurely.



-- 
Steven.



More information about the Python-list mailing list