ios - Swift Memory Leak on NSArray -


i'm developing app using singleton pattern , swift programming language. when profile app instruments, noticed there's memory leak pointing nsarray. instruments pointing following line of code (please check screenshot). can find why leak happening? tried initialize array workout as:

workout = [] 

the leak wasn't reported. maybe has unarchiving? enter image description here enter image description here

checkout answer here: swift decode array custom class memory leak seems bug. had same problem too. instead of directly assign value workout, can do:

if let wo = nskeyedunarchiver.unarchiveobjectwithfile(utilities.getfileurl("workout")) as? [exceciseobject] {     workout = wo.map { $0 } } 

Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -