On Jul 31, 2009, at 6:13 AM, Alexander von Below wrote:
I suspected this means our app is eating memory somewhere, even though there were no leaks. I filed this as a bug (ID# 7015176), but the engineers relied to me that the memory usage in Activity Monitor did not increase. Indeed, I added the Activity Monitor instrument to my trace and could not see any suspicious activity either.
This leads me to my question: Does ObjectAlloc tell me the truth? Is it possible for the graph in ObjectAlloc to rise without the app actually consuming the memory?
This is a bug in iPhone OS for certain types of memory allocations done on your behalf. ObjectAlloc is basically being told that these allocations are malloc() type events, when they are really realloc() type events, and so it is counting them over and over as new memory. You can verify this by checking the details of the particular memory growth your seeing and verifying if the objects generally share the same address (there will typically be a number of addresses used, but the lots of objects will share the same address).
Its not a case of ObjectAlloc lying to you, so much as a case of it being told bad information and passing that on to you.
Or, to phrase this differently: What is the right way to ensure that my app (or certain repetitive operations therein), Mac or iPhone, is not eating memory away? I was alway under the impression that ObjectAlloc is the tool to do that.
If you are concerned about your memory usage, the Activity Monitor tool is very very useful for this type of monitoring, as the ObjectAlloc tool does not show all memory allocations. That said, ObjectAlloc still allows you to get far more details on your memory usage, which can be very useful for diagnosing issues in your application.