Why loading AssetBundle to memory after downloading and unpacking results crash in iPad due to lack of Memory?

1.9k Views Asked by At

We have just finished an 2D game in Unity 2D but struggling to fix some serious issues related to memory.

Version of Unity used: Unity 2017.2.2f1

We are using AssetBundles and On Demand Resource to download the bundles (Textures,sprite sheets,bg images and Scenes) of average size 20MB each.

We have successfully restricted our app store size to 90MB.While profiling the project in Xcode ,the initial memory occupied by the build is 180 MB.But the problem starts now when we are downloading any level (Asset Bundle) via On Demand Resource.The memory usage jumps from 180MB to 568MB.

1.Why unity is consuming 388MB memory after downloading and loading AssetBundle of size 20MB ?

2.Why each time we load a new scene ,unity reserves some memory after unloading the scene i.e not clearing the allocated blocks?

3.Is RGBA Compressed PVRTC 4 bits working in Unity for iOS Devices ?

5.Is there any third party SDK to compress the 2D Textures and GUI Graphics for Unity ?

Please help me ,so that I can deliver the project to client other wise,my job is at risk :(

Thanks in Advance .

1

There are 1 best solutions below

0
buffalo94 On
  1. Check your asset bundle compression and how do you load your asset bundle. Compressed asset bundles are decompressed entirely in memory so it's recommended to use Uncompressed or Chunck Based compression for bundles to avoid memory spikes.
  2. Unity use managed memory loading and unloading things can result in some memory leaks because the GC controls almost everything.
  3. PVRTC work on all IOS devices.
  4. Since you are targeting iOS PVRTexTool is what you need PVRTexTool Download