Search Unity

System out of memory on ios 12 device

Discussion in 'iOS and tvOS' started by leveelunitydev, Dec 18, 2018.

  1. leveelunitydev

    leveelunitydev

    Joined:
    Dec 6, 2016
    Posts:
    11
    Hi

    I am having a problem that I will get an error like this:


    ------------------------------------------------------------------------------------------------------------------
    malloc: *** set a breakpoint in malloc_error_break to debug


    Could not allocate memory: System out of memory!

    Trying to allocate: 33554432B with 16 alignment. MemoryLabel: GfxDevice

    Allocation happend at: Line:62 in

    Memory overview



    [ ALLOC_DEFAULT ] used: 50085486B | peak: 92408180B | reserved: 52510445B

    [ ALLOC_TEMP_JOB ] used: 0B | peak: 0B | reserved: 2359296B

    [ ALLOC_TEMP_BACKGROUND_JOB ] used: 0B | peak: 0B | reserved: 1048576B

    [ IOS new_delete ] used: 0B | peak: 0B | reserved: 0B

    [ ALLOC_GAMEOBJECT ] used: 5006592B | peak: 6978502B | reserved: 5221458B

    [ ALLOC_GFX ] used: 3763871B | peak: 9946817B | reserved: 3948768B

    [ ALLOC_PROFILER ] used: 80B | peak: 80B | reserved: 103B

    [ ALLOC_TEMP_THREAD ] used: 32768B | peak: 0B | reserved: 2588672B

    Could not allocate memory: System out of memory!

    Trying to allocate: 33554432B with 16 alignment. MemoryLabel: GfxDevice

    Allocation happend at: Line:62 in

    Memory overview



    [ ALLOC_DEFAULT ] used: 50085486B | peak: 92408180B | reserved: 52510445B

    [ ALLOC_TEMP_JOB ] used: 0B | peak: 0B | reserved: 2359296B

    [ ALLOC_TEMP_BACKGROUND_JOB ] used: 0B | peak: 0B | reserved: 1048576B

    [ IOS new_delete ] used: 0B | peak: 0B | reserved: 0B

    [ ALLOC_GAMEOBJECT ] used: 5006592B | peak: 6978502B | reserved: 5221458B

    [ ALLOC_GFX ] used: 3763871B | peak: 9946817B | reserved: 3948768B

    [ ALLOC_PROFILER ] used: 80B | peak: 80B | reserved: 103B

    [ ALLOC_TEMP_THREAD ] used: 32768B | peak: 0B | reserved: 2588672B


    (Filename: Line: 1090)
    ------------------------------------------------------------------------------------------------------------------------


    This only happens on a device and never in editor.
    Few things:

    1. There should be enough free memory, I can see in xcode monitor that game takes about 1.05GB of ram and it was taking more and working fine.
    2. This only happens when I use textures loaded from asset bundle / on demand resource
    3. It does not happen on first use, but randomly, when changing scenes. The game object that is referencing those textures is DontDestroyOnLoad and it gets deactivated and activated after scene transition. Again, this does not happen on every scene transition, but randomly.
    4. Game does not crash in a standard way, it is still running, but not actually doing anything after this error (which is expected, but just saying that it did no stop execution)
    5. Unity version is 2017.4.15 LTS

    Any ideas?
     
    Last edited: Dec 18, 2018
  2. Crichton333

    Crichton333

    Joined:
    May 4, 2014
    Posts:
    113
    Can't see if you mentioned the actual device you are using but that would crash on a iPhone6+. Even if you release you would'nt be able to target all iOS12 devices.

    iPhone6+: 645MB/1024MB/62% - usage to crash

    Rule of thumb would be 50% of total RAM crashes the app. Better % results on newer devices.
     
  3. leveelunitydev

    leveelunitydev

    Joined:
    Dec 6, 2016
    Posts:
    11
    Hey @Crichton333 you are right, I forgot to mention the device, it is iphone 6s and the game runs with higher memory usage (up to 1.36GB, it will crash on 1400MB limit, but I don't get to that limit ever), but this happens even at 800MB usage, which is less than 50% on 6s.

    Also, this is technically not a crash, the game will keep running but it will look frozen. Unlike when there is actually a lack of memory where system kindly kills the game.
     
    Last edited: Dec 26, 2018
unityunity