[Development] std::allocate_shared for QSharedPointer
Thiago Macieira
thiago.macieira at intel.com
Sat Sep 9 15:37:00 CEST 2017
On Saturday, 9 September 2017 05:46:49 -03 Sean Harmer wrote:
> Does anybody have any plans to add such a facility? Or is there some
> other facility to avoid operator new here for both the QSP and the
> object itself?
There are no plans. We don't have allocators anywhere in Qt, so I doubt this
will ever happen.
> The QSharedPointers are used in the public API as we can't use
> std::shared_ptr there. I guess the closest I can get without such a
> facility is to maintain a pool of QSharedPointers, a pool of the objects
> and use QSharedPointer::reset() when recycling or just keep the two pools
> in sync whcih I guess makes sense anyway.
That won't help:
inline void reset(T *t)
{ QSharedPointer copy(t); swap(copy); }
Have you benchmarked and found out that the malloc() for the
QtSharedPointer::ExternalRefCountData pointer is the culprit?
--
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel Open Source Technology Center
More information about the Development
mailing list