[lxml-dev] elements in gc.garbage - ok ?

Jeroen van Hilst jeroen at keizerrijk.net
Sat Jan 26 12:13:03 CET 2008


Hi,

While using lxml (which is a great tool!), i am experiencing some memory 
issues.

I have made a small piece of code that makes elements go into in gc.garbage.

I am suspecting this to be the problem of my program cunsuming lots of 
memory.
Can someone tell me if it is ok that this happens - or what the reason is ?

Thanks in advance.

    - Jeroen

#======================
from lxml import etree
import gc

gc.set_debug(gc.DEBUG_LEAK)

for x in range(1,19):
    r = etree.Element('div')
    s = str(x)
    #if the attr is not touched there are no messages from gc
    r.attrib[s] = s

gc.collect()
if gc.garbage: print gc.garbage
#======================

I am using:

Windows XP SP2
Python 2.5.1.1
lxml 1.3.6
libml 2.6,28










begin 666 lxml_mem.py
M(U5S:6YG. at HC4'ET:&]N(#(N-2XQ+C$*(U=I;F1O=W, at 6% @4U @, at HC;'AM
M;" Q+C,N- at HC;&EB>&UL(#(N-BXR. H*9G)O;2!L>&UL(&EM<&]R="!E=')E
M90II;7!O<G0 at 9V,*"F=C+G-E=%]D96)U9RAG8RY$14)51U],14%+*0H*9F]R
M('@@:6X@<F%N9V4H,2PQ.2DZ"B @("!R(#T at 971R964N16QE;65N="@G9&EV
M)RD*(" @(',@/2!S='(H>"D*(" @("-I9B!T:&4 at 871T<B!I<R!N;W0@=&]U
M8VAE9"!T:&5R92!A<F4@;F\@;65S<V%G97, at 9G)O;2!G8PH@(" @<BYA='1R
M:6);<UT@/2!S"@IG8RYC;VQL96-T*"D*:68 at 9V,N9V%R8F%G93H@<')I;G0@
+9V,N9V%R8F%G90H`
`
end




More information about the lxml-dev mailing list