[XML-SIG] PyXML API problem

Martin v. Löwis martin at v.loewis.de
Wed Jul 16 05:48:55 EDT 2003

"Jeremy Kloth" <jeremy.kloth at fourthought.com> writes:

> I forget to mention one other thing.  By using gc.collect() you are simply
> telling Python to run the collection cycle, which is something that it does
> itself at some interval.

Interestingly enough, for XML DOM, the collection frequency might be
too low. Python invokes collection every 700 (used to be 1000)
allocations of container objects. If you have documents with little
structure and large CDATA, the string objects (which are not accounted
for in cyclic thresholds) could consume a lot of memory.

So if invoking gc.collect explicitly helps, you might just as well
invoke gc.set_threshold, to invoke automatic collection more


More information about the XML-SIG mailing list