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
0
Question by dwn · Nov 08, 2012 at 07:00 PM · iostexturememory

Unexpected memory overhead of textures on iOS

I've been investigating the memory usage of our game on iOS and run into some numbers I can't explain. All my results are gathered using the "Allocations" and "Memory Monitor" instruments from Apple's developer tools. For test purposes, all textures are 1024x1024 RGBA8 without mipmaps, with the 'Read/Write Enabled" flag off. The dynamic textures similarly have "makeNoLongerReadable" set to true when applying the pixel changes.

I'm aware of a possible iOS bug with power-of-two uncompressed textures allocating mipmaps even when mipmaps are not active for a texture; I don't see that behaviour in these tests (with an exception described below).

The dynamic textures also allocate temporary read/write pixel storage used to fill the texture. I can see these buffers created/destroyed when I change the "makeNoLongerReadable" flag, and I am not counting that in these numbers.

I am also forcing extra garbage collecting to try to exclude temporary buffers; I can't be certain this is working, however.

My tests are run with an empty scene (for a baseline measurement), 1 - 4 loaded textures, and 1 - 4 dynamically created textures. The results I get are:

                     Allocations    Total Memory
 Empty Scene:        4.13           15.89
 1 Loaded Texture:   4.37           21.18
 2 Loaded Textures:  4.41           24.82
 3 Loaded Textures:  4.44           28.94
 4 Loaded Textures:  4.47           32.89            
 1 Dynamic Texture:  4.59           25.22
 2 Dynamic Textures: 4.63           29.23
 3 Dynamic Textures: 4.66           33.25
 4 Dynamic Textures: 4.69           37.38

The tracked allocations increase as expected.

The first loaded texture seems to take ~5.3M. That would be consistent with the mipmap bug I mentioned above, yet each subsequent loaded texture only takes the expected 4M. Even worse, the first dynamic texture seems to take that ~5.3M plus an additional 4M. Each subsequent dynamic texture, however, only takes the expected 4M.

If I load 1 texture and create 1 dynamic texture, the extra allocated memory does not overlap (~6.63M extra memory), which would, I think, rule out some kind of pixel staging scratchpad. Furthermore, I'd expect any such staging area to be temporary, and the loaded textures do not allocate enough extra space for that purpose.

So what could be causing this extra overhead? Is there any way to eliminate or work around it? Some of the iOS devices we want to support are extremely memory bound so reducing any extra overhead is critical. Given the memory constraints, these extra allocations are taked upwards of 10% of our useable memory space.

Comment
Add comment
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

0 Replies

· Add your reply
  • Sort: 

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

9 People are following this question.

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

Related Questions

Can I load textures at runtime with a smaller memory footprint? 1 Answer

Textures/Atlases and memory management 0 Answers

Loading external Image as Texture2D increases memory consumption dramatically on iOS 0 Answers

Changing textures accumulate in memory. iOS. 0 Answers

Loading a Random Resource in a Folder Without Using Resources.LoadAll 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