iOS Question Make view available for gc

stevel05

Expert
Licensed User
Longtime 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:

DonManfred

Expert
Licensed User
Longtime User
+1 (i´m interested in this info too) :)
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime 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.
 
Upvote 0

stevel05

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