views:

45

answers:

1

When I run my iPhone app with "Leaks" (which has a section for Object Alloc), my app seems to be fine for memory allocation. However, when I run it with just the ObjectAlloc tool, the memory increases steadily as the app runs its main timer. (It is a timer based app). I'm not sure what to trust. I was just wondering if there are any issues with the ObjectAlloc tool that might pertain to me. Maybe something related to NSTImer? I'm running this on the device (not the simulator). Thanks.

+1  A: 

Yes -- trust the tools. They are really quite accurate these days.

Leaks means an object or allocation for which the address of said object/allocation isn't stored anywhere else in your app. The memory is no longer accessible.

However, eliminating all leaks does not mean your app cannot grow without bound.

Unbounded growth can happen for a number of reasons. You might have a cache that keeps adding entries without pruning the least recently used entries. Or maybe a transaction log that is never truncated or flushed to the filesystem. Or you might keep loading new images into your application without throwing out the old.

Once you have eliminated all leaks, look at the output of ObjectAlloc and figure out where all that memory allocation is coming from. In particular, you'll want to figure out what your app is doing to trigger the allocations. The system frameworks won't spuriously cause continual growth without your application directly or indirectly asking for the resources to be consumed.

bbum
The "Leaks" tool has a section for Object Allocation as well. My question is really why is the ObjectAlloc section of "Leaks" giving me different data from the "Object Alloc" tool itself.
NickDK