|
Blocks :
|
|
|
Blocks :
|
In the following code we add byte_size with the Metablock::overhead(), which returns words and not bytes.
size_t get_raw_word_size(size_t word_size) {
// If only the dictionary is going to be used (i.e., no
// indexed free list), then there is a minimum size requirement.
// MinChunkSize is a placeholder for the real minimum size JJJ
size_t byte_size = word_size * BytesPerWord;
size_t byte_size_with_overhead = byte_size + Metablock::overhead();
size_t raw_bytes_size = MAX2(byte_size_with_overhead,
Metablock::min_block_byte_size());
raw_bytes_size = ARENA_ALIGN(raw_bytes_size);
size_t raw_word_size = raw_bytes_size / BytesPerWord;
assert(raw_word_size * BytesPerWord == raw_bytes_size, "Size problem");
return raw_word_size;
}
The code has changed since it was first written, and currently we overwrite the entire Metablock without leaving a header. Because of this we don't have any overhead any more.
Metablock::overhead() is zero in product builds and non-zero in debug builds.