PDA

View Full Version : Date Picker control leaks memory?




onikage
Jul 9, 2010, 03:40 PM
Hello,

I am new to iPhone development and came across an issue. I have a Date Picker control added to my xib in Interface Builder. It is set to Date and Time tumblers.

I noticed that when I ran my app through Instruments testing for leaks it had 1 leak discovered, in NSDateComponents.

I started a completely new View project with absolutely nothing else added except a date picker in IB. Testing in Instruments still yielded 1 leak in NSDateComponents. A friend, who originally discovered this problem in his app, is having the same issue.

This issue doesn't seem to occur when the control is not in Date AND Time mode.

Basically we are interested in knowing if we are not using the Date Picker correctly (e.g. forgetting to implement some required method/delegate stuff) or if this is a problem in the SDK. I'm leaning toward the former since I think of the millions of apps out there someone would have had to encounter the same issue and google didn't find anything so it must be our fault.

Thanks!



themoonisdown09
Jul 9, 2010, 03:57 PM
I'm also building an iPhone app that uses the UIDatePicker in the Date and Time mode and Instruments is picking up a lot of leaks too. Not really sure what that means. :confused:

themoonisdown09
Jul 12, 2010, 09:23 AM
After hours of looking over my code, I still can't figure out why the UIDatePicker is causing a memory leak. I copied my code for the way my UIDatePicker works using Apple's sample application called "DateCell".

I actually took the "DateCell" application and changed the mode to Date and Time (in the sample it's set to just Date) and sure enough, a memory leak shows up.

If someone more experienced in this can test this out to see if we're doing this wrong or what, that would be awesome.


Edit: Something else I've noticed is that every time the month is changed, more leaks appear. For example, if the UIDatePicker is currently set to July 12 and I scroll the picker to have August 4 selected, another memory leak pops up. If I change it back to July 12, yet another memory leak pops up. I'm getting really frustrated now!

Also, I am not listening to the Value Changed event.

PhoneyDeveloper
Jul 12, 2010, 09:43 AM
I haven't seen this but I'm pretty sure this has also been reported on the Apple iPhone forum. So it's probably a bug in the OS library.

themoonisdown09
Jul 12, 2010, 09:46 AM
I haven't seen this but I'm pretty sure this has also been reported on the Apple iPhone forum. So it's probably a bug in the OS library.

My next question would be, will my app be rejected because of this memory leak?

onikage
Jul 12, 2010, 10:23 AM
I haven't seen this but I'm pretty sure this has also been reported on the Apple iPhone forum. So it's probably a bug in the OS library.

Thanks Phoney, but do you have a link? I tried Google, but I don't think I'm getting the right ones to come up.

PhoneyDeveloper
Jul 12, 2010, 11:03 AM
https://devforums.apple.com/thread/56344?tstart=0

A leak like this is very unlikely to cause rejection.