Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

How does reference counting work?

counting Reference
0
Posted

How does reference counting work?

0

While there is currently no automatic garbage collection for gcc’s Objective-C, reference counting takes some of the workload away from manual memory management. Objects descended from NSObject have an intrinsic reference count which starts at 1. If you depend on an object staying around, send it a -retain message. When you are done, send it -release . An object will not be deallocated until its reference count reaches 0. A good article on reference counting is Hold Me, Use Me, Free Me.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123