template<class T, class SegmentManager> void customDeleter<T, SegmentManager>::operator()(const pointer &p){
typedef fixed_managed_shared_memory::segment_manager segment_manager_t;
typedef allocator<void, segment_manager_t> void_allocator;
typedef customDeleter<base,segment_manager_t> base_Deleter;
typedef shared_ptr<base, void_allocator, base_Deleter> base_shared_ptr;
base_shared_ptr baseSP = base_shared_ptr((dbSharableData*)segment.construct<derived>(anonymous_instance)(DERIVED_ID,3.3)
,segment.get_allocator<void>(),
base_Deleter(base_Deleter::segment_manager_pointer(segment)) );
This seems to work because the right deleter is called, and assert() in block_header_from_value() don't fail as before.
But my program get locked in a scoped_lock at boost/interprocess/mem_algo/rbtree_best_fit.hpp:1264 :
template<class MutexFamily, class VoidPointer, std::size_t MemAlignment>
void rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::deallocate(void* addr)
{
if(!addr) return;
//-----------------------
boost::interprocess::scoped_lock<interprocess_mutex> guard(m_header);
//-----------------------
return this->priv_deallocate(addr);
}
I don't understand how and why there's such a lock as I work currently with only one process.
Any hint ?
Regards,
Gaëtan