Search Unity

Memory crash on iOS using Metal Graphics API

Discussion in 'iOS and tvOS' started by hololabs, May 6, 2017.

  1. hololabs

    hololabs

    Joined:
    Nov 15, 2012
    Posts:
    20
    We have a rather large iOS game that is crashing upon launch. XCode reports "Terminated due to memory issue", and we can clearly see the memory grow quickly to ~700MB leading up to the crash. This is before any scene is loaded, and before any of our code has been executed.

    The crash only happens when the Metal Graphics API is selected (we want to use Linear Colour Space).

    It looks like it's happening when reading/compiling shaders (see attached allocation call tree). There's a huge malloc as a result of Shader::Transfer and some ShaderLab initialization stuff.

    Profile.jpg

    If we remove Metal from the Graphics APIs, everything works fine. The memory initially spikes upon load, but not to the same extent, then settles at ~250MB.

    We're not using too many special shaders or anything... mostly Standard Shader:

    shaders.jpg

    This has been reproduced on Unity 5.5.1f1 and 5.6.0f3. I'm testing on an iPad Air using iOS 10.2.

    Is anyone else having this problem with Metal?
     
  2. Mantas-Puida

    Mantas-Puida

    Joined:
    Nov 13, 2008
    Posts:
    1,864
    Could you please make a bugreport? Having repro case would help us to analyze the issue.
     
  3. realtimekat

    realtimekat

    Joined:
    Mar 30, 2014
    Posts:
    8
    Was this issue resolved? I'm coming across the same issue with Unity 2017.4.10f1 crashing on an iPhone 6 device when reading/compiling shaders. The build works fine on newer devices such as iPhone X