Losing memory

  • My application is using (leaking) too much memory and eventually dies because no more can be allocated. I have used Instruments to measure the usage and leaks and have addressed those it told me about.

    Now, however, Instruments indicates that memory reaches a steady state (no more increases) yet the app continues to die for lack of memory.

    Does anyone know of a "next step" I can take to help track down this problem?

    Charlie Dickman
    <3tothe4th...>
  • On Monday, 28 May 2012 at 03:20, Charlie Dickman wrote:
    > My application is using (leaking) too much memory and eventually dies because no more can be allocated. I have used Instruments to measure the usage and leaks and have addressed those it told me about.
    >
    > Now, however, Instruments indicates that memory reaches a steady state (no more increases) yet the app continues to die for lack of memory.
    >
    > Does anyone know of a "next step" I can take to help track down this problem?

    One thing I always find helpful in situations like this is to use Instruments' "Allocations" template, then, ignoring the graph and byte counts, sort the "Statistics" view at the bottom by "# Living" and see if there's anything that seems to be allocated a surprising number of times.

    Often there are large numbers of small objects that are really just handles to other things - for example, objects holding on to memory-mapped files, or OpenGL textures.  These objects don't contribute much to the "Allocations" count, because they themselves are very small.  The things they're holding on to also don't contribute, because they're not 'allocated' in a way the instrument tracks, but they could be taking up a lot of your address space.

    Jamie.
  • On 27 May 2012, at 9:20 PM, Charlie Dickman wrote:

    > My application is using (leaking) too much memory and eventually dies because no more can be allocated. I have used Instruments to measure the usage and leaks and have addressed those it told me about.
    >
    > Now, however, Instruments indicates that memory reaches a steady state (no more increases) yet the app continues to die for lack of memory.
    >
    > Does anyone know of a "next step" I can take to help track down this problem?

    How much memory does your allocation total plateau at?

    How do you know that it's exhaustion of memory that's getting you killed?

    I assume (you don't say) this is iOS, and that your problem is showing up on the device. What does the device's own log show?

    Is your app in the foreground or background at the time?

    Use the VM Tracker instrument and see if you're eating up memory in other zones. In my experience, your application heap (Allocations) can be stable, but if you accumulate Core Graphics/Core Animation buffers, you're in trouble pretty quickly. By default, VM Tracker snapshots the heaps only when triggered (Snapshot Now). It may be better if you check Automatic Snapshotting in the detail area for VM Tracker.

    — F
previous month may 2012 next month
MTWTFSS
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      
Go to today