Boost logo

Boost Users :

Subject: Re: [Boost-users] [ Interprocess ] Object allocation performance
From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2011-10-04 12:28:13

El 03/10/2011 18:35, Yordan Pavlov escribió:
> It looks like this:
> |MyType * pMy= my_segment->construct<MyType>(anonymous_instance)();
> my_segment->destroy_ptr(pMy);
> |
> Where *MyType* is some typical struct and *my_segment* is correctly
> constructed *boost::interprocess::managed_shared_memory ** is around 10
> times slower than the equivalent:
> |MyType * pMy= new MyType();
> delete pMy;
> |
> I did not expect this. I though the two allocation algorithms should be
> similar in implementation and performance. Is there some good reason for
> such a huge difference.

I don't expect my algorithm to be extremely fast as you can't use the
same techniques in heap allocation or shared memory allocation, shared
memory allocation is intended to be more space-concerned than heap
allocation, where you can preallocate big chunks of OS memory and
implement pools. Shared memory allocation is designed avoid any memory
waste or preallocation. If you need a huge number of objects then think
about using arrays or vectors.



Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at