Author Topic: Unity always use double memory for every texture  (Read 6149 times)

jjobby

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 13
    • View Profile
Unity always use double memory for every texture
« on: August 31, 2013, 01:45:21 AM »
Hi, my game has a memory issue. I use many texture Atlas created from NGUI. My game has many GUI atlas and I don't want to compress it due to image quality. I think that one of the main reason which cause the memory issue in my game is because of Unity double memory allocation from each texture atlas. This topic may be more suitable for Unity forum. I have already asked this question in Unity forum.

http://forum.unity3d.com/threads/198270-Does-Unity-always-use-double-memory-for-texture-in-runtime
Quote
I tried creating three built exe on window.
Scene 1. Plane with empty texture.
Scene 2. Plane with 1024x1024 texture RGBA 32 bit 4 MB (from import setting).
Scene 3. Plane with 2048x2048 texture RGBA 32 bit 16 MB (from import setting).

I made sure that all textures didn't use mipmap and didn't read/write enable.

Memory usage in task manager (I waited a bit until all scenes memory were stable)
Scene 1. 29.9 MB
Scene 2. 37.8 MB (different from Scene 1: 7.9 MB)
Scene 3. 62.0 MB (different from Scene 1: 32.1 MB)

It loos like that Unity allocated double memory for each texture. Is this an expected behavior?

But no one seems to know what exactly the reason behind this behavior. I've read that ArenMook is hired by Unity to develop their new GUI. This question may not be related to you. But if you do know about why Unity handle the memory this way then please explain it to me. I want to verify if this is an intended behavior or not.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Unity always use double memory for every texture
« Reply #1 on: August 31, 2013, 12:56:24 PM »
This is not NGUI related at all. You mentioned you bug-reported it, and that's the way to go here.