Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Game crashes due to memory constraints on iPad Air (and some other) devices at ~25%/250mb usage

Discussion in 'iOS and tvOS' started by TimLOM, May 29, 2015.

  1. TimLOM

    TimLOM

    Joined:
    May 18, 2015
    Posts:
    9
    Hey guys, our app is crashing on iPad air and older iPhones once we hit around 250mb (or in the case of the air, 25%) of available memory. The device has no other apps running, has access to almost all of the RAM, yet when I hit around 250mb it just shuts down. Xcode simply says that the app disconnected. Profiling with Instruments reveals that there was a lot of Low Memory Warnings around the time of the crash (even though there was plenty of memory available).

    Any ideas as to what the cause may be?

    Building using the latest version of unity + il2cpp + universal
     
    MrEsquire likes this.
  2. exerion

    exerion

    Joined:
    Jun 29, 2011
    Posts:
    54
  3. bluescrn

    bluescrn

    Joined:
    Feb 25, 2013
    Posts:
    642
    Are you looking at memory usage in the Unity profiler, or in XCode?

    In my experience, the XCode number can be *significantly* higher than the Unity profiler reports. Not sure exactly what Unity's profiler isn't including, though.

    iOS is a bit nasty when it comes to memory. It doesn't guarantee that any app will have a specific amount available. On 512Mb devices (4S, iPad 2), you'll definitely start getting crashes if you reach 250MB. (Some people suggest that as little as 180MB may trigger a memory pressure crash in some circumstances).

    I don't know what the equivalent numbers are for a 1GB device, but from experience, I'd expect problems if you go over about 500MB.

    (That seems a huge amount for a mobile game, but I'm currently looking at a project which is allocating about 160MB of mono/il2cpp heap alone, on top of 70MB of executable+dlls, that's a huge 230MB somehow gone before counting a single asset...)