Dismiss contoller view not deallocate memory

Hi,

I am having problems with memory, because every time I go to a secondary controller view( I perform segue) and backs (I call dismiss) to the main, they don't deallocate memory. Give me memory warnings and eventually crashing my app, if I go more than 3 times to the secondary controller view.

I am programming in swift, so I don't really now how to deallocate manually.


Thanks in advance

Replies

Does your view controllers have references to each others? For example the first view controller is a delegate for the second view controller? If so the delegate property has to be weak or there is a retain cycle. Or have you defined closures? They might also cause a retain cycle. Read more from: https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/Swift_Programming_Language/AutomaticReferenceCounting.html#//apple_ref/doc/uid/TP40014097-CH20-ID52