C++ Logo


Advanced search

[SG14] sizeof_block_metadata function, colony/hive, advice wanted

From: Matt Bentley <mattreecebentley_at_[hidden]>
Date: Thu, 25 Nov 2021 14:35:24 +1300
Hi all,
thinking about including a
size_type sizeof_block_metadata(const size_t block_size)

function for colony/hive, as this would allow the user to ascertain the
amount of memory used by a memory block's metadata in colony (including
skipfield), given the number of elements stored in that memory block.
This is less important for colony which is a fixed implementation, more
important for std::hive which could potentially have many alternative
implementations and these might not be visible to the user in text form.

The idea was that if someone knows how much memory is used by each block
outside of the actual memory used to store the elements, that might aid
in terms of knowing how much cache space is used by the metadata and
people might be able to make better decisions about the min/max
capacities of memory blocks (if they are specifying these manually) on
that basis.

The function would throw an exception if the block_size specified was
outside the minimum/maximum block capacity ranges.

My main question to you is whether this function is worth including - as
it adds yet another function to the codebase.

Received on 2021-11-24 19:35:31