Re: [gdome]future memory management plans? (was: News(2) on CVS preparing 0.7.0)
- From: Paolo Casarini <casarini CS UniBO IT>
- To: Tobias Peters <tpeters uni-oldenburg de>
- Cc: gdome gnome org
- Subject: Re: [gdome]future memory management plans? (was: News(2) on CVS preparing 0.7.0)
- Date: Fri, 9 Nov 2001 18:03:58 +0100 (CET)
On Fri, 9 Nov 2001, Tobias Peters wrote:
> On Fri, 9 Nov 2001, Paolo Casarini wrote:
> > I think I can resolve the problem you have focused in the next week-end. I
> > think I can resolve it without adding any other memory structure only
> > using reference counting and information holded by the libxml2 xmlNode
> > structure.
>
> Well, if you can solve that, it would be great. Maybe I overlooked
> something. (I have now clue how you want to access detached subtrees, and
> look forward to see your idea.)
>
The idea is to use the Gdome_xml_Node.refcnt, the xmlNode.parent and the
xmlNode._private fields to understand if a Node and the subtree under
it is to be freed on unref.
The n->parent field of a root node of a detached subtree is NULL, so when
the user call unref on such node and its refcnt reach 0 we can free its
xmlNode structure.
We need n->_private to know which node of the subtree are to be freed:
Example: suppose to have the follow detached subtree where the node A and
C are referenced each by one GdomeNode*.
<A> //referenced
<B>
<C> //referenced
<D/>
</C>
</B>
<E/>
</A>
When the user call unref on A we can free A, B and E libxml2 underling
structures while C and D are taken live by the C reference. When the user
call unref also on C, we can also free C and D underling libxml2
structures.
Bye,
paolo.
--
Paolo Casarini - casarini cs unibo it
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]