zorba-coders team mailing list archive
-
zorba-coders team
-
Mailing list archive
-
Message #17050
Re: [Merge] lp:~zorba-coders/zorba/feature-mem_size into lp:zorba
On Jan 10, 2013, at 2:28 PM, Markos Zaharioudakis <markos_za@xxxxxxxxx> wrote:
>> The problem is infinite recursion. If I ask for the size of a tree, it's the
>> sum of all the nodes. If the root node includes the size of the tree, then it
>> will recurse infinitely.
>
> I don't understand the infinite recursion problem. What I have in mind is add an alloc_size() method to the XmlNode class, which will return 0 if the node is not a root, otherwise returm mem_sizeof(XmlTree).
If it returns 0, then you could never get the size of an XmlNode (or any class derived from XmlNode) independently of the tree.
IMHO, you should be able to get the mem_sizeof any node (which would include its child nodes, if any) independently of the tree. If you explicitly ask for the mem_sizeof an XmlTree explicitly, then you'd get the size of the tree object itself plus all the nodes.
- Paul
--
https://code.launchpad.net/~zorba-coders/zorba/feature-mem_size/+merge/114764
Your team Zorba Coders is subscribed to branch lp:zorba.
References