iOS Question Make view available for gc

stevel05

Expert
Licensed User
I have read a little about memory management in objective-c, to make a view available for garbage collection the advice seems to be to set the object to nil. In a view intensive app (creating and removing lots of views) Can we achieve this by Redimming the object, or do we need to set it to null?

Edit: And is in fact Null the same as Nil?
 
Last edited:

Erel

Administrator
Staff member
Licensed User
Note that there is no garbage collector. The memory management is based on ARC (automatic reference counting).

Objects without any live references will be released. So if a view is removed from the layout and there is no variable that points to it then it will be released.

The practical difference between GC and ARC is that ARC doesn't solve reference cycles. So if two objects reference each other and are not referenced by other objects they will not be released and there will be a memory leak.
 

stevel05

Expert
Licensed User
Thanks Erel, so either will achieve the desired result.
 
Top