On 6/12/07, Tom Hughes <[EMAIL PROTECTED]> wrote: > In message <[EMAIL PROTECTED]> > Chris McGrath <[EMAIL PROTECTED]> wrote: > > > On 11 Jun 2007, at 20:07, Tom Hughes wrote: > > > >> That was the point - my patches never made it to the list because > >> they were held for moderation and they still haven't been approved. > > > > Stick them up on http://pastie.caboo.se and post the links here. > > Right... First up, here's the simple one, which is a leak in > document.to_s when converting a document to a string where it > leaks a copy of the document text: > > http://trac.openstreetmap.org/attachment/ticket/482/libxml-leak2.patch > > The one that caused real grief trying to fix it is this: > > http://trac.openstreetmap.org/attachment/ticket/482/libxml-leak1.patch > > The basic problem is the failure to free nodes when copying them > into a document, but fixing that reveals lots of problems with > libxml nodes and attributes being used via ruby objects after libxml > has already freed them. > > The problem is that when a node is attached to another node you wind > up with a libxml level C object that is owned both by another libxml C > object (which is itself owned by a ruby object) and by a ruby object. > > If the parent C object goes away first then it frees the other object > that is still be used by a ruby object... > > The patch therefore winds up doing a major rework of the way the > libxml wrapper is handling node and attribute objects. > > Both those patches have been in use on www.openstreetmap.org for > several weeks now and have helped substantially with the problems > we were having. > > Tom > > -- > Tom Hughes ([EMAIL PROTECTED]) > http://www.compton.nu/ > _______________________________________________ > libxml-devel mailing list > libxml-devel@rubyforge.org > http://rubyforge.org/mailman/listinfo/libxml-devel >
I tried to use libxml-ruby recently but suffered serious memory leaks. I was trying to replace elements / attributes, modify attribute values and remove elements. Not knowing any C to speak of I could not fix these memory issues. Would these patches have any chance of fixing these issues? I would love to use libxml as an engine for a whitelister for arbitrary html. Cheers Daniel _______________________________________________ libxml-devel mailing list libxml-devel@rubyforge.org http://rubyforge.org/mailman/listinfo/libxml-devel