Skip to content

memory_pool_collection carves too little memory from block if there are many buckets #148

@psalz

Description

@psalz

Basically, this:

const size_t max_node_size = 512 * 1024 * 1024;
const size_t block_size = 1024 * 1024 * 1024;
memory::memory_pool_collection<memory::node_pool, memory::log2_buckets> my_pool(max_node_size, block_size);
my_pool.allocate_node(256 * 1024 * 1024);

This fails FOONATHAN_MEMORY_ASSERT(no_nodes > 0); in free_list.cpp because memory_pool_collection::def_capacity() returns arena._next_block_size() / pools_.size(), i.e., 2147483632 / 27 = 79536430, which is less than the requested 268435456.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions