Leakage vs Cyclops

Tim Peters tim.one at comcast.net
Sun Jan 5 19:45:08 CET 2003

Note that in the 2.3a1 source distribution, the file


documents the special Python builds you can make to get more info about
references and objects.  There are several.  All except the PYMALLOC_DEBUG
build are also doable in 2.2.2, and some have been available since 0.9.9.

I don't expect it would really help to get a total count of live objects in
the release build:  if that keeps going up, you have a leak, but your memory
use will keep going up too then, so it wouldn't tell you much you didn't
already know ("I have a leak").  In that case, the COUNT_ALLOCS build is
much more helpful:  it keeps track of how many of each type of object is
alive, a measure of throughput for each type of object, and the allocation
highwater mark for each type of object.  It adds a function sys.getcounts()
to let you get at that info too.  COUNT_ALLOCS is relatively lightweight
(compared to a debug build), but still more expensive than you'd like for
production mode, and has the side effect of making new-style class objects

More information about the Python-list mailing list