Custom allocator for shared_ptr

Hello all, I assume that the reference count object pointed to by shared_ptr objects is on the heap. Is there a way that I can specify a custom allocator for shared_ptr to use for this purpose? Thanks, Dave

Dave wrote:
Hello all,
I assume that the reference count object pointed to by shared_ptr objects is on the heap. Is there a way that I can specify a custom allocator for shared_ptr to use for this purpose?
No, sorry. But if you grep for BOOST_SP_USE_STD_ALLOCATOR, you'll see where to patch your local copy - it should be easy. Out of curiosity, why do you need to use a custom allocator? To find leaks, for performance reasons, or because of tight memory requirements (embedded systems)?

Peter Dimov wrote:
Out of curiosity, why do you need to use a custom allocator? To find leaks, for performance reasons, or because of tight memory requirements (embedded systems)?
boost pool allocators would be a great example. They are really useful, and it's a pity that I cannot use them with shared_ptr. Andrey

On 7/28/05, Peter Dimov <pdimov@mmltd.net> wrote:
No, sorry. But if you grep for BOOST_SP_USE_STD_ALLOCATOR, you'll see where to patch your local copy - it should be easy.
Out of curiosity, why do you need to use a custom allocator? To find leaks, for performance reasons, or because of tight memory requirements (embedded systems)?
To be honest, I'm quite surprised it cant be used an allocator with shared_ptr. Is there any reason it cant? (make interface more complex, multi-threading issues, or just too much work, maybe latter ?). -- Felipe Magno de Almeida Developer from synergy and Computer Science student from State University of Campinas(UNICAMP). Unicamp: http://www.ic.unicamp.br Synergy: http://www.synergy.com.br "There is no dark side of the moon really. Matter of fact it's all dark."
participants (4)
-
Andrey Melnikov
-
Dave
-
Felipe Magno de Almeida
-
Peter Dimov