Replies: 1 comment
-
I've watched this excellent talk and I understand my issue now - the "unexpected" (by me..) allocations came from bucket management of the unordered_map container and they should be taken into account when planning my pool. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I'm trying to define an unordered_map which pre-allocated all the memory needed for its work to avoid memory operations during runtime (for a performance sensitive app).
I have the following code:
I'm expecting the pool to allow me to insert
(size_to_allocate / memory::unordered_map_node_size<memory::unordered_map<int, int, memory_pool>::value_type>::value)
items into the map before the buffer runs out of memory but in fact I see that I can insert much less items (for example with 1MB buffer I'm expecting 32767 items but my buffer is exhausted after ~27000). I can also see that some items insertion reduces the capacity in the free list of the memory_arena by more than 1 (sometimes 2, sometimes 3).Important to note - I do not have repeating keys and do not expect key hash collisions (if it has any relevance).
I do not understand what is going on there. I guess I'm probably missing something but I can't figure out what.
Can anyone please help?
Thank you in advance!
Beta Was this translation helpful? Give feedback.
All reactions