|
Boost : |
From: Miki Jovanovic (miki_at_[hidden])
Date: 2000-01-31 13:29:55
"greg colvin" <gcolvi-_at_[hidden]> wrote:
> What is sad here is how easily Dave could hack up an allocator that is
> way faster than the system defaults. There is no reason, given what
we
> know about memory allocation, for the system allocator to be any
slower
> than what Dave did, but vendors keep on shipping crap.
The most important problem (for me) with using heap for storing ref
counters, ptrs or anything is this: thread safety. To make it thread
safe, everyone has to heavily protect their memory managers. Now, if
you have lots of small units, smart pointers, lists, temporary objects
all of them accessing heap, all of their memory allocations will have
to be serialised, meaning only one thread at a time being allowed to
allocate memory. This makes the memory manager a serious bottleneck in
a real application.
So, while I am looking for a good/better smart pointer, I still use
intrusive smart pointer in speed critical objects (also taking into
account memory fragmentation from keeping the object and the reference
counter separate).
Linked pointer seemed like a silver bullet, because it bypassed the
memory manager, and still did not have big overheads, but now I see its
drawbacks too. It is important to keep this conversation going just so
as many facts and theories about the different implementations are
discovered.
Cheers,
Miki Jovanovic.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk