Skip to main content

Instruments: Why Does the Allocations Instrument Show the Wrong Amount of Memory Usage?

·2 mins

I’ve seen this question asked multiple times on Stack Overflow. The person asking the question is using the Allocations instrument to profile the memory usage of an iOS app. The Allocations instrument reports less memory being used than the app is really using. Why isn’t the Allocations instrument reporting the correct amount of memory?

The Allocations instrument does not record OpenGL ES texture memory allocations. If your app does anything with images or video, the Allocations instrument will not record the video memory used to store the images or video. The more your app works with images or video, the greater the discrepancy between your app’s actual memory usage and the amount of memory the Allocations instrument says your app is using.

How do you get Instruments to report your app’s actual memory usage? The Activity Monitor instrument can be configured to list the amount of physical memory each running app uses. My Xcode 6: Instruments UI Changes post has more information on how to configure an instrument. To dig deeper into your app’s texture memory usage, use the OpenGL ES Analysis instrument.

Why use the Allocations instrument? The Allocations instrument can show you the lines of code that are allocating the most memory in your app. If all you care about is the amount of memory your app is using, use the Activity Monitor instrument. When you need more information on your app’s memory usage, use the Allocations instrument.