On Dec 16, 2012, at 8:43 PM, Markos Zaharioudakis <markos...@yahoo.com> wrote:

> The memory size of some std containers is underestimated, because the 
> book-keeping overhead is not taken into account. I understand we cannot be 
> 100% exact here, but should we try to consider some common std 
> implementations and measure the mem size accordingly? For example, std::map 
> is typically implemented as a red-black tree, which should add at least 2 
> pointers (or offsets) per entry into its memory size.

OK, I added sizeof(void*) * 2.

On Dec 16, 2012, at 8:53 PM, Markos Zaharioudakis <markos...@yahoo.com> wrote:

> I think we should define Base16::alloc_size() and Base64::alloc_size() 
> methods. The Base16::alloc_size() method should then be used in 
> HexBinaryItem::alloc_size() (which is not quite correct right now).
> StructuralAnyUriItem::alloc_size() does not count theEncodedValue
> StreamableStringItem::alloc_size() does not count theStreamableDependent


On Dec 16, 2012, at 10:00 PM, Markos Zaharioudakis <markos...@yahoo.com> wrote:

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

> Also, I think the null-terminating byte is not counted.

The alloc_size is its capacity.  The null byte is irrelevant.

On Dec 17, 2012, at 2:52 AM, Markos Zaharioudakis <markos...@yahoo.com> wrote:

> The size of XmlTree is not counted.

Right: because it's shared by all nodes in the tree.

> An instance of XmlTree is shared by all nodex in the same xml tree. Maybe the 
> size of the XmlTree should be attribute only to the root node of the tree.

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.

- Paul

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