← Back to team overview

zorba-coders team mailing list archive

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

 

> 
> > 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)).

-- 
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