Boost interprocess cached pools

Posted by porgarmingduod on Stack Overflow See other posts from Stack Overflow or by porgarmingduod
Published on 2010-04-21T08:19:39Z Indexed on 2010/04/21 8:23 UTC
Read the original article Hit count: 441

I'm trying to figure out if my reading of the docs for boost interprocess allocators is correct.

When using cached_adaptive_pool to allocate memory:

typedef cached_adaptive_pool<int, managed_shared_memory::segment_manager>
  pool_allocator_t;
pool_allocator_t pool_allocator(segment.get_segment_manager());

// Allocate an integer in the shared memory segment
pool_allocator_t::pointer pool_allocator.allocate_one();

My understanding is that with multiple processes one can allocate and deallocate freely: That is, if I have a cached pool allocator for integers in one process, then it can deallocate integers allocated by similar pools in other processes (provided, of course, that they are working on the same shared memory segment).

It may be a stupid question, but working with multiple processes and shared memory is hard enough, so I'd like to know 100% whether I got the basics right.

© Stack Overflow or respective owner

Related posts about c++

Related posts about boost-interprocess