Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can a vector use a memory pool with a small_node_pool ? #168

Closed
chrisics opened this issue Jun 27, 2023 · 0 comments
Closed

Can a vector use a memory pool with a small_node_pool ? #168

chrisics opened this issue Jun 27, 2023 · 0 comments

Comments

@chrisics
Copy link

Hello,
The following throws when the list is constructed.
Somewhere a proxy to a std::container is allocated with the allocator passed to it and the proxy has size 16 and 16 is larger than sizeof(Item).
The goal is to speed up vectors with lots of small items, single threaded. Or should I use another allocator for that?
Thanks,

struct Item
{
    int16_t a = 0;
    int16_t b = 0;
};

using MemoryPoolType = memory::memory_pool<memory::small_node_pool>;
using ListType = memory::vector<Item, MemoryPoolType>;

void test()
{
    MemoryPoolType pool(sizeof(Item), 1024);
    ListType list(pool);
    list.push_back(Item());
}

Repository owner locked and limited conversation to collaborators Jul 9, 2023
@foonathan foonathan converted this issue into discussion #170 Jul 9, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant