Interesting. Thanks. I’ll have to try that. The latest Xcode 8.2 release version seems to have fixed this. I am no longer seeing the leak. Take care, Chris
> On 17 Dec 2016, at 02:33, Ray Fix <ray...@gmail.com> wrote: > > FWIW, seeing this too. Also, when I boiled the project down to a macOS > command line and run the “leaks" cli I don’t see the leak. 🤔 > > Ray > >> On Oct 14, 2016, at 9:42 AM, Chris Chirogene via swift-users >> <swift-users@swift.org> wrote: >> >> Xcode8 is showing a memory leak in instruments and the memory graph. I have >> narrowed it down to this: deriving from NSObject produces a leak indication. >> I have no idea why. >> I need an NSObject to later use the @objc directive. >> The Test instance stored in the mDict Dictionary is indicated as a leak in >> Xcode. >> This is running as an iOS Single-View-Application project in the iPhone5s >> Simulator running iOS10.0 >> Here is the sample code: >> >> import Foundation >> >> class Test: NSObject // <-- derived from NSObject produces leak >> indication below >> { >> static var cTest: Test! = nil >> var mDict: [String : Test] = Dictionary<String, Test>() >> >> static func test() -> Void { >> cTest = Test() >> cTest.mDict["test"] = Test() // <-- alleged leak >> } >> } >> >> class Test // <-- NOT derived from NSObject, NO leak indication >> { >> static var cTest: Test! = nil >> var mDict: [String : Test] = Dictionary<String, Test>() >> >> static func test() -> Void { >> cTest = Test() >> cTest.mDict["test"] = Test() // <-- NO leak >> } >> } >> >> // from AppDelegate didFinishLaunchingWithOptions >> // ... >> Test.test() >> // ... >> >> _______________________________________________ >> swift-users mailing list >> swift-users@swift.org >> https://lists.swift.org/mailman/listinfo/swift-users > _______________________________________________ swift-users mailing list swift-users@swift.org https://lists.swift.org/mailman/listinfo/swift-users