Hi,
I hate having memory leaks and usually pride myself on, blah, blah, blah. Help!
The leaks I have aren't crazy big (a few K at max), but I want to remove them for sure. There are two categories of leaks and I've got some screen shots of each from Instrument's Leaks tool.
The first is just some odd Java/Web thing that happens within 10 seconds of running my app: Regardless of what code branch I take. It's like something is happening in the background that is causing it. I have some sample code from well respected authors of iPhone programming and theirs does the same thing, so I'm not worried too much about the 64 bytes I lose during my app run. This leak will occur long before I create any of my web-based forms such as MapKit tools like the reverse geocoder... but I do use them later in my code.
The second, however is insidious and I feel like a fool for not being able to track it down... because making it occur is so SIMPLE. All I do is create a UITextField in Interface Builder and use it like every other time I've ever done before. It happens on any UITextField I create whenever the iPhone pops up the virtual keyboard. And, the memory leaks are pretty substantial (hundreds of bytes at a time); presumably from the graphics involved with creating the on-screen buttons.
So, to be clear, when I touch inside of any of these text fields, the virtual keyboard pops up and I leak a few hundred (or more) bytes. I don't even type anything, assign any variables, etc. It only happens the first time the virtual keyboard pops up per text field, by the way. (So my leaks are "somewhat contained.") (That's what they said about a recent oil well, eh?)
You're going to ask what's different about the controller that owns these UITextFields. Well, the only thing I can think of is that it's a dynamically created UIViewController that is being managed by a UINavigationController.
Since in both of these cases, my code never shows up on the stack, I'm not sure what my next steps should be. I've run the new XCode static analyzer and while it reported a couple of warnings, they are benign red herrings.
So, I'm looking for advice on what my next steps should be. (I've begun the process of commenting out code, going to backups, etc.)
Screen shots of the Leaks tool attached.
Looks like I can only include one link until I get some rep points. I'll show the latter leak.
Memleak 2 screen shot: link text
-Pete
P.S. I'm using the latest Xcode (3.2.3) as of today with the newest 4.0.2 iOS.