Hi,
hopefully I'm doing something horribly wrong, but it seems like there is a memory leak in NSCalendar.components. Simply calling the method will leak something. Doing it in a loop will show it better:
let calendar = NSCalendar.currentCalendar()
let startDate = calendar.dateWithEra(1, year: 2015, month: 10, day: 4, hour: 12, minute: 0, second: 0, nanosecond: 0)!
var i = 0
var j = 0
for(j = 0; j < 1000000; j++) {
for(i = 0; i < 1000000; i++) {
let components:NSDateComponents = calendar.components(NSCalendarUnit.Hour, fromDate: startDate) // LEAK!
}
}I would expect that components goes out of scope and is cleaned up, but while the loops are running memory will go only up.
I've tested on native iOS 9 and the simulator, but both show the same behaviour.
What am I doing wrong???
Thanks