Questions tagged [boost-pool]

Boost Pool Library provides a memory allocation scheme that is very fast (but limited in its usage)

Pools are generally used when there is a lot of allocation and deallocation of small objects.

  • boost::pool_allocator is a more general-purpose solution, geared towards efficiently servicing requests for any number of contiguous chunks.

  • boost::fast_pool_allocator is also a general-purpose solution but is geared towards efficiently servicing requests for one chunk at a time; it will work for contiguous chunks, but not as well as pool_allocator.

Further details: http://www.boost.org/doc/libs/1_58_0/libs/pool/doc/html/index.html

32 questions
9
votes
2 answers

Dealing with std::string/std::vector member variables while using boost::singleton_pool

I am writing a performance critical application in which I am creating large number of objects of similar type to place orders. I am using boost::singleton_pool for allocating memory. Finally my class looks like this. class MyOrder{ …
bisarch
  • 1,388
  • 15
  • 31
8
votes
1 answer

How to use boost::pool library to create a custom memory allocator

I am new to boost and I want to know how exactly the boost::pool libraries can help me in creating a custom memory allocator. And I have two vector of struct objects. First vector is of structure type A, while second vector is of structure type…
R Parthiban
  • 89
  • 1
  • 6
8
votes
1 answer

Boost pool allocator slower than new

So i made this container allocator memory_pools class based on boost pool : memory_pools.hpp #ifndef MEMORY_POOL_HPP # define MEMORY_POOLS_HPP // boost # include # include template
Drax
  • 12,682
  • 7
  • 45
  • 85
7
votes
1 answer

Boost Pool maximum size

I am using boost pool as a static memory provider, void func() { std::vector > v; for (int i = 0; i < 10000; ++i) v.push_back(13); } In above code, how we can fix the size of pool, i mean as we know…
user2424663
  • 71
  • 1
  • 4
5
votes
2 answers

Using boost::pool to manage the memory allocations in a std::vector

I want to have a std::vector of objects, with the objects allocated using boost::pool. Is something like this correct: class MyClass { private: double data; public: MyClass(double d) : data(d) { } }; int main() { std::vector
Verwirrt
  • 403
  • 2
  • 13
5
votes
2 answers

How does boost.pool achieve re-use of allocated memory?

Background My previous question about boost.pool led me to investigate boost.pool in detail, and now I have a supplementary question to finalize my understanding. Prelude This reference states the following about the object pool pattern: The object…
jwalk
  • 1,120
  • 11
  • 27
5
votes
1 answer

Custom allocation using boost singleton_pool slower than default

I wrote custom operator new and operator delete for the class MyOrder. I am allocating memory using boost::singleton pool. Here is the program testing the performance, #include #include #include…
bisarch
  • 1,388
  • 15
  • 31
4
votes
1 answer

Clarification on the "object pool" pattern?

I was under the impression that an object pool is a design pattern used for managing a group of pre-allocated objects to which a client can request and be returned one of these objects. However, it seems that boost.pool's object_pool class has more…
jwalk
  • 1,120
  • 11
  • 27
3
votes
1 answer

Boost::Pool not linking

I am using boost::pool. It only has header file, no dll or o or lib file. It should work without them. When I compile my code though it says: LNK1104: cannot open file 'libboost_thread-vc100-mt-gd-1_49.lib' Why is this? There should be no .lib…
user25800
  • 33
  • 10
3
votes
2 answers

How to decide on stack vs heap vs boost::pool allocation in a case like this?

I have a class that uses boost::variant to store a double or a string, like this : class value { boost::variant val; }; It's supposed to be an immutable value type for a toy interpreter I'm playing with. At first it seemed…
fingerprint211b
  • 1,176
  • 12
  • 24
3
votes
0 answers

Pool based memory allocation for multi thread application

What are the available improved Performance with Custom Pool Allocators? (e.x. in terms of the multi-thread access to the pool) Or let's say: Is there any updated answer to this question? Can multithreading speed up memory allocation? This question…
H'H
  • 1,638
  • 1
  • 15
  • 39
3
votes
1 answer

Move constructor is not called when using boost::pool_allocator

I have the following simple test code. #include #include #include "boost/pool/pool_alloc.hpp" struct Frame { uint32_t i{}; Frame(uint32_t _i) : i(_i) {} Frame(const Frame& f) { std::cout << "Copy…
3
votes
0 answers

memory pool usage (boost::pool) for variable sized buffers?

The bottleneck of my current project is heap allocation... profiling stated about 50% of the time one critical thread spends with/in the new operator. The application cannot use stack memory here and needs to allocate a lot of one central job…
Hhut
  • 1,128
  • 1
  • 12
  • 24
3
votes
2 answers

Object creation in boost::singleton_pool

I am trying to use boost::singleton_pool to create a large number of objects of a type 'Order' in a highly performance critical multithreaded application. Looking at the documentation, this is what I should be doing, struct OrderTag{}; typedef…
bisarch
  • 1,388
  • 15
  • 31
2
votes
1 answer

How can I get the sizes of the allocations that needs to be done for this handler?

The below code is using a handler that provides a custom allocator. The allocator is provided with an instance of BucketPool that can allocate different sizes, but the sizes of the allocations that can be made needs to be specified at compile…
tuple_cat
  • 1,165
  • 2
  • 7
  • 22
1
2 3