> > The function alloc_sizeof( rstring<RepType> const &s ) does not count the
> book-keeping overhead for the various kinds of strings. For example, the
> default rep (which is used for zstrings) adds 12 bytes oberhead (on 32-bit
> machines).
> I changed it to:
>         return s.capacity() + (s.is_shared() ? 0 : sizeof( RepType ));

This is fine with me, but there are many other things that are shared and yet 
their sharing is not taken into account (e.g. qname items in the qname pool, or 
atomic items shared among the nodes of copied xml trees). I think we should 
have a consistent solution about what to do with "shared" things. There are 
several options, but I will let Matthias decide about this.
> > Also, I think the null-terminating byte is not counted.
> The alloc_size is its capacity.  The null byte is irrelevant.

capacity() does not include the null-terminating byte. The actual number of 
bytes allocated is capacity()+1 (plus sizeof(RepType)).

Your team Zorba Coders is subscribed to branch lp:zorba.

Mailing list: https://launchpad.net/~zorba-coders
Post to     : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp

Reply via email to