Hacker News new | ask | show | jobs
by mabster 791 days ago
Yep, we've always had our own implementation of std::shared_ptr<> for this reason.

Either the reference is elsewhere (and now you have to dereference another area of memory occasionally which is the worst case for cache performance), or its alongside your object. If its alongside your object it's better to know it's there for padding, etc.

And it's easy to forget to allocate for the alongside case, so you can have hidden poor performance.