Reputation: 991
I have written the code in objective C ARC project everything is working fine but after running my project 20-25 my project crash. i have tested my project on xcode instrument there i found no leaks my in instrument i have observed that my live bytes are continually increasing. Is there is any way to handle this or there is any way to remove everything all and free the allocated memory of my project.
Upvotes: 0
Views: 137
Reputation: 467
The most common cause of this is retain cycles. Retain cycles happen when you have two objects A and B that hold strong references to each other. By definition, an object won't get released by ARC until its reference count is 0. Therefore, you can't delete A unless you delete B first, and you can't delete B until you delete A.
To solve this, change one of the strong references to a weak one. Typically, you want the container class to hold a strong reference, and the child class to only hold a weak reference to its container. Here are some examples and more detailed information:
Upvotes: 3