How to release a subview immediately when it performs @selector(removeFromSuperviw) in iOS ARC? -


as mentioned title.how release subview when performs @selector(removefromsuperviw) in ios arc? seems subview not released after [subview removefromsuperview] resulting in memory leak.

if not being released next draw cycle (a small fraction of second), retaining somewhere else, or have created retain loop. classic memory leak error in cocoa, , need find bug.

somewhere have 2 objects refer each other via strong reference, , 1 of them needs weak reference (or removed, or set nil, or otherwise broken). 1 possibility view controller has strong reference view. it's possible there isn't cycle; may other live object still has reference.

(don't over-read this. arc not garbage collection. there no other object literally "holds" view. it's object incremented retain count , nothing has decremented yet. newer developers have easier time pretending it's garbage collection can't handle retain cycles.)

cocoa love provides nice introduction problem.

instruments can useful tool using objectalloc or leaks instruments, find little thought , code searching finds problem more quickly.


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -