I have a working iPhone app using SDK 4.0. It shows no leaks in the 'Instruments' tool, and I am fairly convinced that the code does not have any memory leaks.
I then tried to add iAds to the app, and it started showing memory leaks. In order to nail down the problem, I removed all additional code.
All that is left is an added AdBannerView to the .xib file (without doing a single modification to the working version of the code without iAds). This shows memory leaks.
Every time the view loads, the 'Instruments' tool shows 5 leaked blocks of 16 bytes each, with the Responsible Library 'Foundation', and Responsible frame
[NSCFString copywithZone:]
Further running the app gives me leaks from the Responsible library 'iAd' (2 leaks of 48 bytes each), and the responsible frame:
[AdBrandingFrame initWithFrame:]
Further, I also get 48 byte leaks with the responsible library 'UIKit' and responsible frame
-[UIView _createLayerWithFrame:]
Since there is absolutely no addition to my working non-leaking code, except an added AdBannerView to the .xib file, I wonder if it is Apple's code that causes the leak. Although the leak is relatively small, I would like to iron it out. I understand that there is a possibility that a leak shows up even though there may not be one (the pointers might still be held by the OS in some way that Leaks does not know about - It would be great to know if this is the case).
So I had two questions:
1) Is there any chance the problem is actually my code, and the leak for some reason only shows up after adding AdBannerView? If there is such a possibility, I would run another thorough code test.
2) If this is a problem with Apple's code and any of you have encountered this, are there any workarounds you have found?
Any help would be greatly appreciated. Thanks!