instruments with iOS: Why does Memory Monitor disagree with Allocations?

I believe this is due to the fact that memory usage from OpenGL ES is hidden from ObjectAlloc, but counted in Memory Monitor. For example, see zoul's tests in his question here, where he observes a slight uptick in ObjectAlloc on creation of a texture, but then that memory disappears from that instrument when passed off to OpenGL ES. Memory Monitor still tracks that texture memory.

This should include the visual aspect of UI elements, like layers and views, because CALayers are effectively wrappers for OpenGL ES textures. The actual 2D image representation of your UI elements don't appear to be tracked by ObjectAlloc, which leads to the lower total values in ObjectAlloc.

ObjectAlloc is still good for tracking numbers and types of allocations, and is even more valuable since the advent of the heapshot functionality. You just want to partner it with Memory Monitor to look at your true overall memory usage.


For those who sees this post after the year 2012:

The memory really loaded into device's physical memory is the Resident Memory in VM Tracker Instrument.

Allocation Instrument only marks the memory created by malloc/[NSObject alloc] and some framework buffer, for example, decompressed image bitmap is not included in Allocation Instrument but it always takes most of your memory.

Please Watch WWDC 2012 Session 242 iOS App Performance: Memory to get the information from Apple.


Memory monitor will count most or all resources held by the application, including indirectly allocated ones at the kernel level. This includes AFAIK video memory (textures etc.) as Brad suggested, but also memory mapped files and possibly largish kernel structures such as sockets. The list is probably quite long...