2

I created a test project to confirm my memory leaks: Project file: https://dl.dropbox.com/u/3703182/PickerView.zip

Basically a UIPickerView is connected to a datasource via IB. When it's connected to a datasource, it leaks. If not, no leak. I need to use a UIPickerView for an imminent app that needs to be released ASAP, unfortunately it guarantees a crash every 2 hours because of the leak. How can I use the UIPickerView despite the memory leaks without crashing?

EDIT: It only leaks on device, not in simulator.

ninjaneer
  • 6,951
  • 8
  • 60
  • 104
  • What exactly is the steps to reproduce the leaks. When I try to run your code, it was not showing any picker and I had to move it out from inner view to outerview to get it displayed. However I couldnt see any leaks in both cases. Can you try uploading the exact code which showed leak? – iDev Nov 14 '12 at 01:36
  • That's the exact code that shows a leak. I should have mentioned that you have to run it on a device since the simulator doesn't show a leak. Click on the `Picker` button, then click `back`. Do a snapshot in Instruments and it'l show these leaks: http://img844.imageshack.us/img844/5200/screenshot20121113at633.png – ninjaneer Nov 14 '12 at 02:34
  • I dont think, your app will crash due to this leak. Check if there is something else which is using a lot of memory. The leak in the screenshot shows some framework, which you dont have to worry. – iDev Nov 20 '12 at 09:37

4 Answers4

1

That is not a leak. It's an allocation. If it was a leak it would show a red spike in the second row. The real test for a leak is presenting and dismissing several times over. If you can do that and show that the allocations keep rising then there is a leak. Not otherwise.

dantastic
  • 134
  • 1
  • 10
0

This is the Apple library that is leaking. You cannot do anything about this. It is Apple's fault.

maxned
  • 393
  • 2
  • 16
  • Sorry, no. This shouldn't affect your app a lot because if you look, the framework is leaking very little. – maxned Nov 20 '12 at 17:23
0

This isn't a leak you can control, it's internal... but this is a very small amount of memory and will not crash your application. I'd be interested in seeing what this looks like an hour in... Can you provide a backtrace of the crash? That would probably better help determine the real cause of the crash.

0

Adding my comments as answer,

Your app will not crash due to this leak since it is a very small leak caused by framework which you dont have to worry about. The screenshot shows that it is in terms of a few bytes. If your app is crashing every 2 hours, that means there is something else which is using a lot of memory. Please check if you are using anything else in your code which could cause this and update the question with your finding.

In allocation tool, make sure you are checking the live bytes section and check how much it is going up. If it stays below 15-20 MB, you dont have to worry much anyways. Check this for more details about memory usage in app. Also check this XCode Instruments Allocations: Look at Live Bytes or Overall Bytes?.

Community
  • 1
  • 1
iDev
  • 23,310
  • 7
  • 60
  • 85