views:

41

answers:

2

Hi all,

I'm checking memory leaks in my apps using Instruments Leaks tool.

After fixing all leaks whose responsible library is my app. I figure out that there still have a lot of leaks whose responsible libraries are iOS's framworks, based on what Instruments said?

This is a screenshot of Intruments:

alt text

I think these leaks may be caused by some of my misuse of frameworks' methods. What is your approach when getting leaks like these?

Thanks!

A: 

I've been noticing the same with one of my apps and in the end, after trying to figure out what I am doing wrong, I came to the conclusion I'm doing nothing wrong and that Apple's frameworks have memory leaks as well.

So I don't think there's anything you can do.

Stelian Iancu
BTW, it's not good to have leaks after running our apps, no matter who is responsible for. How about try to figure out what kind of methods that likely introduce leaks (like loading nib, or sth like that), and then replace them with safer approach. Do you have any experience about this?
Thanh-Cong Vo
+1  A: 

Well Apple Developers are also human, and they also can make mistakes. Alternative would be to create your own framework exactly same to that of Apple's but that will not be nice thing to do as Apple will certainly come up with upgrades and fixes in future that will resolve the issues.

The only solution would be to report bugs to Apple about memory leaks, even I have seen that framework has lots of memory leaks.

There are also other reasons for memory leaks, instruments may show memory leaks in apple's framework, but it is not necessary that it is caused by the framework's bad code, indeed it could be the bug in our code where we did not follow correct steps, for example we add observers but we do not remove them, we bind for events but we do not remove them, so if we have not done cleaning operations correctly, instruments may show leak but somewhere else.

Akash Kava
"indeed it could be the bug in our code where we did not follow correct steps" <- this is kind of misuses I'm looking for. Thanks for suggesting some, I haven't noticed them before.
Thanh-Cong Vo