Memory management/leaks: Linux toolchain vs Xcode. Anyone else experienced this?

Discussion in 'iOS Development' started by jbonedev, Jun 17, 2009.

  1. jbonedev

    jbonedev New Member

    Joined:
    May 24, 2009
    Messages:
    44
    Likes Received:
    0
    Device:
    iPhone 3G (Black)
    I've written my app on Linux using the toolchain and deployed to a jailbroken iPod touch.
    - Ran Clang on the source. Thanks Skylar for the sticky on using this tool. Thanks helpful and friendly folks on the Clang mailing list for helping me get this to work with my platform.
    - Fixed all leaks reported by Clang

    My app consumes memory until it crashes during one use case which involves:
    - UI event (button touch) spawning a separate NSThread, using it's own NSAutoreleasePool in the thread's selector function.
    - According to the sbsettingtoggle launched by swiping finger across the top bar while this thread runs, mem drops to 5megs and then the app crashes.

    This leads me to believe I have some horrible memory leak.
    So I port the entire build process/Makefiles to work in Xcode (and on the Linux toolchain so I can build in either env)
    When I run this in the iPhone Simulator using Instruments, I don't see any memory leaks.

    But I've read that Instruments w/ the iPhone Simulator doesn't always report leaks properly.

    So I create my certs and deploy to the actual iPod device. Same thing, no memory leaks seen in Instruments, and also no crashes. Though the sbsettingtoggle shows available memory drops as low as 10 or 9 megs, the app never crashes.

    Is this a toolchain bug? Should memory drop this low if Instruments and Clang detects no leaks? (Yes it's a Debug build, maybe that's related?)

    Thanks for any advice
  2. Chicken

    Chicken Retired Moderator

    Joined:
    Feb 17, 2008
    Messages:
    2,494
    Likes Received:
    7
    Device:
    iPhone 5S
    It may just be the system killing your application. If your application consumes so much memory and there is only x amount of memory left the system will kill it.
  3. jbonedev

    jbonedev New Member

    Joined:
    May 24, 2009
    Messages:
    44
    Likes Received:
    0
    Device:
    iPhone 3G (Black)
    Thanks for the reply chicken.

    I guess my question is why am I seeing two different behaviors. The build from the Linux toolchain consumes memory until it crashes. The same code built in xcode does not crash and shows no leaks in Instruments.

    Please Register or Log in to view images

Share This Page