Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
3
Question by whydoidoit · May 10, 2013 at 04:26 PM · iosmemory usageprofiling

So how much memory is my iOS game using?

I've got three numbers that don't match between XCode "Allocations", "Memory Monitor" and the new detailed view Unity Profiler.

Unity profile says I'm using 99MB of memory XCode Allocations says 131MB XCode Memory Monitor says 232MB

I'm guessing the latter is right, because I start getting allocation warnings when it goes above 250MB and am killed shortly afterwards (on an iPad2).

So how am I meant to work out what is using what? What do I multiply my Unity detailed profiler readings by to get an accurate picture?

I've tried multiplying Texture and Meshes by 2 - this gives 150MB, but clearly multiplying the whole thing by 2 wouldn't give me the reading of Memory Monitor.

What techniques can I use?

Details about the app:

  • Vuforia plugin

  • Scaleform plugin

  • Scene has around 8000 tris, 3 skinned mesh renderers, everything else static.

  • 2 cameras (1 for reflection texture, this is a dressing room).

Comment
Add comment · Show 7
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image rutter · May 10, 2013 at 06:59 PM 0
Share

Interesting question. I can't say anything for sure, but this seems like a decent educated guess:

  • Unity Profiler sees only $$anonymous$$ono's allocations, not those made by the native engine code.

  • XCode Allocations sees both script and engine allocations, but reports them based on the runtime (virtual memory, allocated in bytes).

  • XCode $$anonymous$$emory $$anonymous$$onitor reports allocation based on the operating system's paging (physical memory, allocated in larger blocks/segments/pages).

Is it possible that your program is suffering from memory fragmentation?

It could also be that each report is including an additional layer of infrastructure overhead, but if that's the case then it's surprising that the last number is so much bigger.

avatar image whydoidoit · May 10, 2013 at 08:15 PM 0
Share

Good advice, thanks. I should look at that fragmentation (though why it would be happening I don't know) - the virtual memory size (which is apparently memory span on the device) is almost 490$$anonymous$$B. The $$anonymous$$ono $$anonymous$$emory size is around 50$$anonymous$$B, so it appears that the other stuff is something to do with:

  • Resources/Assets

  • Scaleform

  • Vuforia

So I've just tried running Scaleform on its own and it's 25$$anonymous$$B (in Instruments) Vuforia seems to be about 30$$anonymous$$B (in Instruments).

There's still a huge difference, it's very confusing!

avatar image whydoidoit · May 12, 2013 at 03:46 PM 0
Share

It certainly appears that Unity is reporting the texture memory it uses, when actually the phone needs to allocate that again to be shared with the GPU.

avatar image Graham-Dunnett ♦♦ · May 12, 2013 at 09:17 PM 0
Share

Bear in $$anonymous$$d that you'll get a memory warning when iOS starts to notice memory is short. You might find that all the other apps that are still in the background are using memory. So, try rebooting the device and see if you get memory warnings. iPad2 has 512$$anonymous$$ of memory and I guess your device has half of that memory in use by other apps. (I'm not a massive expert on iOS memory. Will flag this question up to developers.)

avatar image whydoidoit · May 12, 2013 at 10:58 PM 0
Share

Actually it's been tried on multiple test devices (iPhone 4, 4S, iPad 2, iPad $$anonymous$$ini) which are rebooted between installations, so it appears (and I've read somewhere) that iOS isn't very happy about any app using more than half of the memory.

It's just hard to work out what I should be trying to save memory on, because I've got more than double the usage from the only detailed view I have access to :S

I'm presu$$anonymous$$g the $$anonymous$$ono memory usage is accurate (because surely it can be), so I need to work out how come I'm using more than 200$$anonymous$$B when Unity says I'm using 60$$anonymous$$B in assets.

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by kromenak · May 11, 2013 at 08:14 PM

I've spent a bit of time looking into this in the past; the Unity profiler provides memory info on assets loaded into the game, but unfortunately it isn't a complete picture of memory being used.

The XCode memory monitor is certainly the most accurate value, and also the one that really matters; it is an accurate indicator of when you will start seeing memory warning and ultimately an app crash.

Also, FWIW, I'm under the impression that there are three areas in Unity that use memory: managed heap, native heap, and the app code. Managed heap is stuff allocated in script, native heap is mainly assets, and app code is all the code and DLLs. The app code can actually bite you pretty hard. Unity by itself is a good chunk of memory (8-14MB I think) and then any DLLs or code associated with Vuforia or Scaleform might be pretty heavy as well. App code is pretty much always in memory; loaded up on app start and stays until it closes.

Anyway, as I said, I've spent some time working through Unity's memory puzzle, but I'm certainly not an expert - so if any of the above sounds wrong, please correct me!

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

17 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Can Standard Shader be removed from a build? 0 Answers

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

[iOS] Memory management, memory is not released when scene is changed 0 Answers

UpdateDepthNormalsTexture 0 Answers

AR Foundation adding reference images at runtime causes memory leak on iOS, but works fine on Android. 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges