2

I have a memory leak in my iOS app which sometimes causes it to crash. The Leak is found here. Would anyone know how i would debug this?

 0  0x269760    Malloc 32 Bytes Malloc  1   00:03.718.759   32  libsystem_info.dylib    si_item_to_addrinfo
CodeGeek123
  • 4,341
  • 8
  • 50
  • 79
  • 3
    You need to post more than this. Run leaks in instruments to find out more. – Rengers Jul 02 '12 at 16:32
  • 1
    A system call for 32 Bytes is never the problem. – CodaFi Jul 02 '12 at 16:32
  • I don't know a whole lot about fixing memory leaks, but I would recommend turning on NSZombieEnabled to help you find the source of your leak. More on that here http://stackoverflow.com/questions/4168327/what-is-nszombie – paul jerman Jul 02 '12 at 16:32
  • 1
    Looks like you might leak memory here if you call `getaddrinfo()` without calling `freeaddrinfo()`, but as others have pointed out, that's probably not the issue. (see [si_getaddrinfo.c](http://opensource.apple.com/source/Libinfo/Libinfo-330/lookup.subproj/si_getaddrinfo.c) and [libinfo.c](http://www.opensource.apple.com/source/Libinfo/Libinfo-391/lookup.subproj/libinfo.c)) – mpontillo Jul 02 '12 at 16:35
  • @codaFi - Does this mean i ignore all leaks that are maybe less than 100 bytes? I did run leaks and thats how i found the error. However im not sure how to navigate from there and fix the error because the leak doesnt appear in my code. – CodeGeek123 Jul 02 '12 at 16:35

2 Answers2

6

One 32 byte leak is not going to cause a memory consumption jetsam.

First, post the backtrace of the crash(es). Secondly, use the Allocations instrument to see if memory is accreting over time.

If memory is accreting and you have some repeated action (say, visiting a bit of UI and returning to the main screen of your app), Heapshot analysis can do wonders.

bbum
  • 162,346
  • 23
  • 271
  • 359
5

For me, it's the Testflight SDK 1.1. When I comment out the [TestFlight takeoff:] method, the leak doesn't appear anymore.

ninjaneer
  • 6,951
  • 8
  • 60
  • 104