I reported this about a year ago, but it has never been fixed and it seems like it should be fixed for the Swift 4.0 release.
Here is a simple repro case. If you watch the memory monitor as it runs, you see memory consumption climb to 2.7GB when using #function, and no memory increase when using a static string. import Foundation class A { var counter = 0 { // didSet { onSet("counter") } // no leak didSet { onSet() } // huge leak } var properties = ["counter" : 0] func onSet(_ name: String = #function) { properties[name]! += 1 } } var myclass = A() for i in 0..<10000000 { myclass.counter = i } print(myclass.properties["counter"]!)
_______________________________________________ swift-users mailing list swift-users@swift.org https://lists.swift.org/mailman/listinfo/swift-users