Instruments ObjectAlloc: Explanation of Live Bytes & Overall Bytes

IphoneObjective CXcodeInstruments

Iphone Problem Overview


I'm using Instument's ObjectAlloc tool in an attempt to understand what the memory my application (iPhone) is doing and when and where it is doing it.

I would really like a basic explanation of these statistics:

  • Live Bytes
  • #Living
  • #Transitory
  • Overall Bytes

When I am trying to work out how much memory my application is using, am I to look at Live Bytes or Overall Bytes? Does this include leaked memory? What are Transitory objects?

Thanks

Iphone Solutions


Solution 1 - Iphone

ObjectAlloc tracks all memory allocation and deallocation over the time your program is running.

The Living bytes, or Net bytes is how much memory your application is using at the time you select in the timeline. That will include leaked memory, since leaked memory is never deallocated.

#Living is how many allocations of a certain size/object type happened (and are still allocated). This is very useful when looking for leaks.

For example, if you repetitively perform an action (like coming in an out of a modal view controller), and you see that #Living of an object grows by the same amount each time, then you're probably leaking those objects. You can then confirm by drilling down and seeing the exact line of code that is allocating the objects, and even see the time index each one was created.

Overall bytes includes memory that has been released. It's useful to track that number for performance optimization purposes, but not if you're just trying to see your current memory footprint or look for leaks.

Solution 2 - Iphone

Stats explanation from apple docs. Link to the document

enter image description here

enter image description here

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionRossView Question on Stackoverflow
Solution 1 - IphoneKen AspeslaghView Answer on Stackoverflow
Solution 2 - IphonePranav JaiswalView Answer on Stackoverflow