memory management - When ARC is triggered in the lifecycle of an iOS app? -


this question has answer here:

the arc used in ios , object automatically deallocated when reference count 0. in example of swift book, code sets var nil in order make reference count 0. in real ios app, may not purposely set nil release memory unless object large.

my question is, when deallocation in arc happen in lifecycle of app? considering 2 cases:

  1. if segue 1 viewcontroller next viewcontroller, first viewcontroller deallocated automatically? assume not retain copy in next viewcontroller.

  2. if ios somehow killed our app, needs memory or something, clear memory used our app? or set nil , trigger arc finish work? if there strong reference cycle in code, there memory leakage in case?

  1. its answered here, first view controller not deallocated if pushes/presents controller.
  2. if ios kills app, memory holds app released. next when open app, fresh launch. , there called memory warnings, when device running out of memory or app consumes lot of memory os send out memory warnings. implement didreceivememorywarning method , release un used data or resources. may save app killing os.

Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

Nuget pack csproj using nuspec -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -