Re: [xml] Support for Python



On Mon, 28 Jan 2002, Daniel Veillard wrote:

On Mon, Jan 28, 2002 at 07:59:18PM +0000, Matt Sergeant wrote:
On Mon, 28 Jan 2002, Daniel Veillard wrote:
  I don't think we can have garbage collectable xmlDoc, though nearly
every other classes exposed should be garbageable.

We do this with a proxy object in the Perl interface - the proxy simply
makes sure that the refcount doesn't get lost, and then DESTROY
(equivalent of __del__) does the xmlFree stuff. Works mostly quite well,
though it's a bit tricky to debug.

  Does that mean that each time you export a new object (attribute,
element, etc...) from the interface you inc the ref and dec it each time
one of those is destroyed ?

Yes. Well, inc the ref of whatever was in the proxy object.

  The problem is to keep all this coherent in case of more complex operations
like cut an past or if the doc reference from those node disapear. Sounds
tricky to debug all case, I agree. Question, is it worth it ?

No, it's not really worth it [1]. I've got my hopes now on the XML::GDOME
module which of course just uses libgdome's memory management. Finding and
fixing these refcount bugs is just too damn hard.

[1] Well in some ways its worth it, like the fact that we got a very very
fast DOM that mostly works and we can pass to libxslt.

-- 
<!-- Matt -->
<:->Get a smart net</:->




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]