Instruments and Memory Debugger reports false leak when calling initializer with an @objc protocol argument in Swift

Originator:david.ronnqvist
Number:rdar://28606552 Date Originated:04-Oct-2016
Status:Duplicate of 27932061 (Closed) Resolved:
Product:Developer Tools Product Version:Xcode 8.0 (8A218a)
Classification:Other Bug Reproducible:Always
 
Summary:
If you call an initializer that has an @objc protocol argument on an NSObject subclass, it is reported leaks the argument being passed according to both Instruments and the Memory Graph, but it's actually a false positive (doing the same thing in a loop doesn't cause memory to grow).

This was originally reported as a bug on Swift: https://bugs.swift.org/browse/SR-2839

Steps to Reproduce:
Alternative 1: 

1. Run the attached sample project
2. Click Debug Memory Graph

Alternative 2:
1. Instrument the attached sample project using the Leaks instrument

Expected Results:
Neither the Memory Graph nor Instruments should report a leaked `Inner` object

Actual Results:
Both the Memory Graph and Instruments should report a leaked `Inner` object

Version:
Xcode 8.0 (8A218a)

Notes:


Configuration:


Attachments:
'LeakReproduce.zip' was successfully uploaded.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!