I implemented an NSMutableArray in my app which has approximately 12,000 strings in it. In the allocations instrument it takes roughly 1000 KB and causes my total allocations to be 2200 KB.
Will using a massive array like this cause low memory warnings?
I have noticed low memory warning in the allocations instrument. Is there a way to see the total used/available memory of the device?
There’s no way to view the ‘available’ memory, although Instruments will happily show you how much your app is consuming. This is for a number of reasons: even if it did show you how much memory was ‘available’ it wouldn’t be very useful because it varies considerably in the field depending on what’s in the background, whether you’re listening to music, on a call, etc.
It’s because of this problem that you have memory warnings: there are several levels, and they provide your app with opportunities to free up memory and avoid being terminated.
However, the 2200 KB you’re talking about it not really that much in the grand scheme of things (if it helps you visualize these things, a 1024×768 image takes up more memory than that). So I wouldn’t worry too much: that said, it’s always beneficial to have your app respond to memory warnings by freeing up objects you don’t need, if you can.