The ARC is used in iOS and an object will be automatically deallocated when the reference count is 0. In the example of the swift book, the code sets some var to nil in order to make the reference count to be 0. In a real iOS app, I may not purposely set something to nil to release memory unless the object is really large.
My question is, when will deallocation in the ARC happen in the lifecycle of an app? I am considering two cases:
If we segue from one viewcontroller to the next viewcontroller, will the first viewcontroller be deallocated automatically? Assume we do not retain a copy in the next viewcontroller.
If the iOS somehow just killed our app, say it needs memory or something, does it just clear all the memory used by our app? Or it will set something to be nil and trigger the ARC to finish the work? If there is some strong reference cycle in the code, will there be memory leakage in this case?