Retain cycle when grabing values or keys from Dictionary in Swift
问题 When I grab values from a Dictionary and put them into Array, I can't release memory any more. I tried to remove all object from Array and Dictionary, but these object still exist somewhere (deinit were not called). I was playing in the following way: class MyData { let i = 0 init () { NSLog("Init") } deinit { NSLog("Deinit") } } var myDictionary:Dictionary<String, MyData> = ["key1":MyData(), "key2":MyData()] // Init was called twice // here is the problem: extract values from Dictionary var