Darwin: Disable QMacAutoReleasePool tracker unless explicitly enabled

There's a few orders of magnitude of overhead using QMacAutoReleasePool
with the tracker enabled, so disable it even for debug builds, unless
explicit auto release pool debugging has been enabled via the environment
variable QT_DARWIN_DEBUG_AUTORELEASEPOOLS.

Pick-to: 6.5
Change-Id: Iec00c703eb21e1914903954cfd02f9f6b1ec2a1f
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
Tor Arne Vestbø 2023-05-08 11:18:57 +02:00
parent 59c686080d
commit 7cf7e88417

View File

@ -230,6 +230,10 @@ QMacAutoReleasePool::QMacAutoReleasePool()
: pool([[NSAutoreleasePool alloc] init])
{
#ifdef QT_DEBUG
static const bool debugAutoReleasePools = qEnvironmentVariableIsSet("QT_DARWIN_DEBUG_AUTORELEASEPOOLS");
if (!debugAutoReleasePools)
return;
Class trackerClass = [QMacAutoReleasePoolTracker class];
void *poolFrame = nullptr;