From 9f983eac9f926b4ea3ee4ec860f58dc33a5b7fe7 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 22 Feb 2014 23:30:22 +0100 Subject: [PATCH] QJNI: optimize QSharedPointer creation Instead of QSharedPointer(new T), use QSharedPointer::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 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/corelib/kernel/qjni_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/kernel/qjni_p.h b/src/corelib/kernel/qjni_p.h index b1f0011b94..83dd3a00af 100644 --- a/src/corelib/kernel/qjni_p.h +++ b/src/corelib/kernel/qjni_p.h @@ -177,7 +177,7 @@ public: { jobject jobj = static_cast(o); if (!isSameObject(jobj)) { - d = QSharedPointer(new QJNIObjectData()); + d = QSharedPointer::create(); if (jobj) { QJNIEnvironmentPrivate env; d->m_jobject = env->NewGlobalRef(jobj);