Get total memory allocated

Hi everybody!

I am trying to figure out why my app is not running on iPhone, but works on Android platforms…well it console of Xcode organiser it tell me that there is not enough memory…So I decided to use a profiler to have a closer look. In Unity profiler gives stat on amount of allocated memory in mb - it tells 100 mb. When I run internal profiler from XCode, it gives me the only line about memory: used heap: 315392 allocated heap: 487424. As far as I understand it is in bytes, so it is like my app uses less than 1 mb of memory…

So, does anybody know how to get that Total Memory amount on a device??? or what are the indicators telling me that there is smth wrong with scripts or graphics…

Many thanks for any help!

use xcode instruments

Ostwind, thank for reply!

If you are aware about that instruments, would you be so kind to name them or give any other hints for search?

Thank you!

Hi, Use the Profiler in Xcode and check in Activity Monitor.

Hi Aleksey,

First, the heap lines in the profiler that you mention are for the internal Mono heap, not for the entire application. If Mono is only using 1MB of memory, it is more likely that your app’s memory usage is related to something else. Most likely that ‘something else’ is graphics memory. You are probably filling up the device’s memory with images.

You can see the memory crash logs in the Organizer window of XCode. Go to Window->Organizer, and look at the Device Logs for your device. You should see a log entry of type ‘Low Memory’ and it will say (active) next to your app name. For example:
Name UUID Count resident pages
APP_NAME <5eade59488c03968b1c4f75a4dd96d55> 93293 (active)

The number of pages, 93293, is the number of 4KB pages used. For example this app used up 364MB of memory and was shut down.

You can also run Instruments and use the Memory Monitor to view the amount of memory used. I usually choose ‘blank’ and then search for Memory Monitor in the instruments. This will give you an overall memory number. But since it is most likely that you are running out of memory from textures, you may want to add the ‘OpenGL ES Analyzer’ and the ‘OpenGL ES Driver’ instruments. I like to watch the ‘Texture Uploads’ numbers on the Analyzer, as this will tell you when and how much texture memory is being put into the gpu. I also like to watch ‘Gart Used Bytes’ which will tell you how much texture memory in general is being used.

Slater, thank you)))

pushxtonotdie, that was a cool guide!))) thank you so much! I wil try now to figure out how to use all mentioned instruments above))

No problem aleksey. Good luck with your endeavours.