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
2
votes
1 answer

boost fast_pool_allocator sometimes requests a huge allocation

I have a highly threaded application that uses boost's fast_pool_allocator (version 1.55) underneath quickfix (1.13.3). The application allocates a large number of objects over the course of the day, growing more-or-less linearly until we shut it…
John S
  • 3,035
  • 2
  • 18
  • 29
2
votes
0 answers

boost::object_pool constructor number of arguments

I am using boost::object_pool interface from the boost pool library. By default boost::object_pool::construct can take up to three arguments. I need to pass 13 arguments to construct one of the objects. I defined the m4 macro NumberOfArguments (the…
bisarch
  • 1,388
  • 15
  • 31
1
vote
1 answer

boost pool alternative to calloc

all, If you use boost pool library, how would you replace the following statement: MyStruct *someStruct = (MyStruct *) calloc(numOfElements, sizeof(MyStruct)); If it was for one element, I would do: boost::object_pool myPool; MyStruct…
pinpinokio
  • 505
  • 5
  • 19
1
vote
2 answers

boost::pool_allocator significantly slower than std::allocator

I am learning about memory pool, and trying to utilize boost::pool_allocator in my project. According to the documment, I made a small test about time cost: template void test() { using namespace std::chrono; auto t0 =…
VictorBian
  • 675
  • 1
  • 4
  • 17
1
vote
1 answer

boost pool with specified element size, and specified initial # of element?

boost::pool<> constructor takes "element size" parameter. boost::object_pool constructor takes "initial # of element" parameter. I want to create pool with "element size S" and "initial N of element". Is this possible with boost::pool ? Thank you
eugene
  • 39,839
  • 68
  • 255
  • 489
1
vote
1 answer

boost pool_allocator memory pool behavior clarification

The boost documentation as below: Note The underlying singleton_pool used by the this allocator constructs a pool instance that is never freed. This means that memory allocated by the allocator can be still used after main() has completed, but may…
Alex Suo
  • 2,977
  • 1
  • 14
  • 22
1
vote
1 answer

How to use cmake to find the boost pool library?

I've installed boost like this on Ubuntu 14.04: sudo apt-get install libboost-all-dev libboost-dev If I have the following in my CMakeLists.txt file: SET ( Boost_DEBUG 1 ) SET ( Boost_USE_STATIC_LIBS ON ) SET (…
Stéphane
  • 19,459
  • 24
  • 95
  • 136
1
vote
2 answers

Using boost.pool instead of 'new' for container of objects

In the code base I'm working on, it currently has code that does this often: // In the header: class Label { public: void ParseText(); private: Letter* m_myArray; }; // In the CPP: void ParseText() { delete[] m_myArray; m_myArray =…
void.pointer
  • 24,859
  • 31
  • 132
  • 243
0
votes
0 answers

How to use boost_pool with std::vector?

I need to create many objects which all contain a std::vector of the same size (but the size is known at runtime). I already use boost_pool for the objects allocations. What's the right way to use boost_pool for the std::vector inside…
fontanf
  • 209
  • 1
  • 6
0
votes
1 answer

Boost Singleton Pool release_memory vs purge_memory

Where can I find the difference between purge_memory and release_memory in Boost Singleton Pool? In here it says: Singleton Usage is the method where each Pool is an object with static duration; that is, it will not be destroyed until program exit.…
Koosha
  • 1,492
  • 7
  • 19
0
votes
1 answer

Free all objects in boost::singleton_pool

Is there a way to free all of the objects in a boost::singleton_pool at once? I see that I have access to these methods: static void free(void *const); static void ordered_free(void *const); static void free(void *const, const size_type); static…
ollietedder
  • 63
  • 1
  • 6
0
votes
1 answer

Boost Pool Library: How to reuse created objects?

So at the beginning of my program I want to create some buffer array on some 3 costume data elements (structs of chars and there length for example). I want to pass out from my app first than second element etc after all 3 elements were taken into…
Rella
  • 65,003
  • 109
  • 363
  • 636
0
votes
0 answers

allocate_shared with boost pool allocator

I am trying to use std::allocate_shared with boost pool allocator, the programs runs fine except it crashes with segfault in shared pointer destructor after some time. I am wondering whether my implementation has a bug. i am pasting the allocator…
Ravikumar Tulugu
  • 1,702
  • 2
  • 18
  • 40
0
votes
2 answers

How to reuse a memory block previously allocated to a vector in c++

I have multiple vectors of structure objects for different structures. Now I want to reuse the same memory for all the vector objects.i.e,Once my work is done with one vector i want to erase its elements from the memory and assign that memory to the…
R Parthiban
  • 89
  • 1
  • 6
0
votes
1 answer

How to use boost::simple_segregated_storage?

I try to use the boost::simple_segregated_storage, but I can`t understand how to use it correctly. There are no any samples. I use it in next way: boost::simple_segregated_storage pStorage; const int num_partitions = 100; const int…
AeroSun
  • 2,401
  • 2
  • 23
  • 46