QJNI: optimize QSharedPointer creation

Instead of QSharedPointer<T>(new T), use QSharedPointer<T>::create(), since the latter
co-locates the refcount and the T instance in a single memory allocation, unlike the
first form, which uses separate memory allocations.

Change-Id: I5095ac43448aad9a7e3ec07ed4dcdca869bcd9e8
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
bb10
Marc Mutz 2014-02-22 23:30:22 +01:00 committed by The Qt Project
parent 6813a21c52
commit 9f983eac9f
1 changed files with 1 additions and 1 deletions

View File

@ -177,7 +177,7 @@ public:
{
jobject jobj = static_cast<jobject>(o);
if (!isSameObject(jobj)) {
d = QSharedPointer<QJNIObjectData>(new QJNIObjectData());
d = QSharedPointer<QJNIObjectData>::create();
if (jobj) {
QJNIEnvironmentPrivate env;
d->m_jobject = env->NewGlobalRef(jobj);