Scheduling an NSTimer will create a retain loop between the run loop and the target of the timer. You break that retain loop by invalidating the timer.
Share and Enjoy
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"
NSTimer.scheduledTimerWithTimeInterval(0.01, target: self, selector: "timer_action:", userInfo: nil, repeats: true)
NSTimer.scheduledTimerWithTimeInterval(0.01, target: self, selector: #selector(timer_action), userInfo: nil, repeats: true)
You have to specify the selector correctly.
Unknown selectors can cause a memory leak.
I am terribly sorry that I made a big mistake that I thought "Total Bytes" indicated in Instruments meant amount of allocated memory.
I did not know that it contains released allocation memory.
I should have looked "Persistent Bytes".
During my longrun test, it did not increase proportionally (at most 3MB).
I apologize that I made you confused and wasted your time.
Thank you for helping me.