
On Sun, 2005-07-31 at 11:31 +0200, Jasper van de Gronde wrote:
Out of curiosity, any specific reasons for not using smart pointers? (I'm not saying that I think you should, just interested in general reasons not to use them) Or is it just a matter of not wanting to put smart pointers into the mix of explicitly managed memory and garbage collected memory that already exists (if I understood correctly).
That and the fact that smart pointers invariably introduce a high hidden performance cost, yes.
Applications using smart pointers pervasively invariably die a death of a thousand cuts performance-wise. Even if you can inline the ref()/unref() functions, you're still paying a nasty cache penalty every time you have to touch the refcount member.
It wouldn't be bad if smart pointers were smart enough to elide unneeded ref()/unref() cycles (so it would then be more equivalent to explicit refcounting performance-wise), but there's no way for them to perform that sort of high-level optimization in most cases. So you end up paying the penalty for every trival smart pointer operation...
-mental