I'm testing my app on Instruments -> Leaks
And I have a leak that I can't eliminate, because I can't understand its roots.
What should I do?
P.S. These leaks appear after such steps:
App goes to background with visible keyboard.
App goes to foreground.
I enter any letter on the keyboard.
If the keyboard is invisible before going to background = no leaks
one http://iwheelbuy.com/leak.png
two http://iwheelbuy.com/leak1.png
three http://iwheelbuy.com/leak2.png
I will suggest in applicationWillEnterBackground in AppDelegate.h, just resign First responder.
Related
After spending several hours on finding some leaking NSCFStrings in Instruments I seem to have realized that calling Cocoa's -animator proxy is causing this.
It is always reproducible: Just create a new Xcode project, add a new NSTableView in IB, fill it with some test data and run Instruments with Leaks. Once you hover over the NSTableView so that the scrollers fade in and out, you'll notice at least one leaking object in Instruments.
Although I've already filed a bug to Apple, can anyone confirm this leak?
Demo-Project: https://www.dropbox.com/s/lszveuwrsuaxxg5/TableViewMemoryLeakStackOverflow.zip
Screencast: https://www.dropbox.com/s/vqtwbkus3jygdb3/ProxyAnimatorMemoryLeak.mov
This bug was resolved in OS X 10.9.3.
Good afternoon,
I was doing some Instruments testing on my iOS app that I'm about to release, but I noticed some VERY strange memory leaks, that appear to be coming from System libraries.
When I ran Instruments I got this leak:
Which is extremely weird from my point of view! I went to the Call Tree of these leaks and they all appear to be deep C++ system calls.
What confuses me even more is that this project has ARC enabled, and I ran it through the Analyzer and no problems showed up.
Even more weird is that this DOES NOT happen on the Simulator, nor on my real iPad, but on my iPhone this problem happens.
And when I check "Show Obj-C only" and "Hide System Libraries" the call trace disappears which leads me to believe my code is not responsible for the leak.
Why is this happening and what can I do to fix it?
Thanks guys.
The above leak is not a leak inside your app and it is inside apple's library which you dont have to worry about. If you have fixed all the leaks inside your app, you are fine. Apple will not reject your app just because of this small leak.
I have iOS 6 application that consists of UIView with many UIButtons (like 9 to as many as 100) displayed at same time; all buttons are movable, so I'm changing button's frame property all the time.
After using the application for a couple of minutes (= moving buttons around the parent UIView), app slows down. It is very strange also that it seems buttons that are near the bottom of the screen (= parent UIView) are much slower than those on the top of screen.
All buttons belong to same class, inherited from generic UIButton.
It happens only on real device, not iPhone simulator.
Any idea about the issue? I'm using NSlog frequently through the code. Can this be the problem?
Thx,
DJ
You can set your NSLogs to be only in DEBUG mode, it will be much faster in Relese:
#ifdef DEBUG
NSLog(#"log");
#endif
Yes you are right.
Never give NSLog or DLog in release versions..
remove all nslog, or for testing purpose just comment them out.
#ifdef DEBUG
NSLog(#"log");
#endif
or
#define NSLog //NSLog
Also you should check for zombies and memory leaks.
I'm trying to solve a memory leak in my iOS app and struggling. I'm using the leaks tool to try to isolate the problem. To my surprise, the leak seems to be happening 100% within the UITableView gesture recognizer code. Specifically, the leak count increments each time I stop scrolling (release) the UITableView. Even weirder, this happens with a UIWebView as well. And with a UIScrollView.
So each time I release a drag action on any of these UIKit objects, I get a memory leak. The UI pieces are at different, distinct places around my app, so it's not just localized to one screen.
Ideas?
I am developing a complete application using the template "page-based storyboard".
But whenever I turn page, I see thru the instruments that the amount of memory allocated only increase and never decrease, so until a crash occurs.
Trying in iPad device crash too.
To simplify and try to find the problem, I created a test app using the same template and opting for ARC, only loading the image of the pages that I use and no change anything in the original apple code, even in this simple application the problem occurs.
I think the problem is because all page are stay allocated like this issue
PageViewController: How to release ViewControllers added to it?
but I m using storyboard, so, where is:
PageView *pView = [[PageView alloc] init];
I have:
MWViewController *dataViewController = [storyboard instantiateViewControllerWithIdentifier:#"MWDataViewController"]
I try to put autorelease but no effect.
The problem that I was having is that I was using background image in all pages and the imageNamed: method caches images which makes my memory footprint grow. I used the UIImage initWithContentsOfFile: method and my foot print stayed mostly flat.