Memory crash on iOS using Metal Graphics API

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.

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:

3059331--229795--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?

Could you please make a bugreport? Having repro case would help us to analyze the issue.

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