← Back to team overview

zorba-coders team mailing list archive

Re: [Merge] lp:~zorba-coders/zorba/feature-mem_size into lp:zorba

 

size:size(<a><b>foo</b></a>) returns 101. This is wrong because just sizeof(ElementNode) is 52 and the tree <a><b>foo</b></a> consists of 2 element nodes, one text node and one (hidden) attribute node. 

The reason for this wrong result is in this struct:

template<typename T>
struct size_traits<T*,false> {
  static size_t alloc_sizeof( T *p ) {
    return p ? mem_sizeof( *p ) : 0;
  }
};

Basically, an InternalNode has a vector of XmlNode*. So, the above struct is instantiated with T being XmlNode. Then, mem_sizeof(XmlNode) is called returning just 20 (== sizeof(XmlNode)).


-- 
https://code.launchpad.net/~zorba-coders/zorba/feature-mem_size/+merge/114764
Your team Zorba Coders is subscribed to branch lp:zorba.


Follow ups

References