> On Aug 27, 2017, at 10:57 AM, Edward Connell via swift-users
> <[email protected]> wrote:
>
> 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.
What was the SR or radar number?
-Joe
>
> 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
> [email protected]
> https://lists.swift.org/mailman/listinfo/swift-users
_______________________________________________
swift-users mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-users