ios - Memory Management in Swift -
so, have navigation controller, connected view controller. view controller can go same type view controller different content. view controllers memory intense, it's quiet expensive push each new 1 of them. problem when click button , view controller gets popped, memory doesn't release itself. there should do, set thing don't use nil etc. ? because, suppose have 5 images display, each of them takes 5-10 mb in memory, when push new view controller on top of 1 on spend 30-50mbs of memory, , okay, when click "back" button , view controller gets popped up, expect these 50mbs released. not case, however. can give me hint on should manage memory more efficiently ?
also, there a nice way free memory taken uiimageview in swift?
so, more precise, view controller's deinit doesn't called when view controller gets poped navigation stack. same applies custom subviews of view controller. how can ensure cleaned arc, , there tools can me track references keep these things in memory.
okay, solved it. quick tip might having same problem. 1)have fields (except numbers , books optionals). nil them out in deinit. 2) nil out can reference object in memory, example, easy forget delegation. if view acts delegate, don't forget break connection. 3)if using maps in apps, advisable use 1 shared map , redraw , change delegate every time, rather instant instinct new maps on every view them. maps can hard clean memory(i tried map applymemoryfix, didn't work)
Comments
Post a Comment