Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

iOS iPad 2 memory pressure crash

Discussion in 'iOS and tvOS' started by jococo, Dec 4, 2015.

  1. jococo

    jococo

    Joined:
    Dec 15, 2012
    Posts:
    232
    Memory pressure issue apparently with the textures?

    Using Unity 5.1.2.

    I have scripting back end set to IL2CPP per iOS App Store 64bit requirements.

    However this apparently seems to be causing memory pressure issues with others and now me.

    I have reduced all textures as small as possible and some other tips but still seeing over 300mb memory use in 1 level of game.

    Here are some screenshots from profiler with game running in Unity.

    The 1st image shows rendering texture memory use of only 12.9mb.

    But then the 2nd shows Texture Memory used of 353.7mb.

    What's up with that?





     
    Last edited: Dec 4, 2015
  2. CPXTom

    CPXTom

    Joined:
    Apr 24, 2010
    Posts:
    113
    You really need to be using the profiler with the device. You will get inaccurate results if you profile memory in the editor.
    Are all your textures power of 2? Are your textures compressed? Are you keeping around textures you no longer need?
    If you have a tonne of tiny textures, you may want to consider putting them into a texture atlas.
     
  3. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,018
    Profile the device, not the editor.
     
  4. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Yep profile device - and try not to use more than half the device's ram for your game. That was true for me back when I was developing on iOS.

    That's probably about 256mb.
     
  5. CPXTom

    CPXTom

    Joined:
    Apr 24, 2010
    Posts:
    113
    Generally I've found on those 512 devices it's a bit less than half. The os will usually start killing your game around 230mb. Sometimes you can get higher, but around 230 the game becomes unstable.
     
  6. jococo

    jococo

    Joined:
    Dec 15, 2012
    Posts:
    232
    When I used profiler on device it simply crashed as level was loading and Xcode popped up memory pressure issue and nothing else. The level never loaded which is why I tried in editor.

    I have tons of textures in the project not being used at all (remnenants from previous similar style game). Can those affect memory even if not used?

    I also have asset packages from the store that have lots of stuff I don't use. Even if not used those also need to be cleared out?

    I figured Unity would only build what is used in the game.

    The ones used in game are powers of 2 and compressed within unity.
     
  7. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,018
    Well if you really are using a ton of textures and a ton of ram then you need to use less. There isn't something we, or unity can do.

    If you think for some reason Unity is loading more stuff than it needs then that needs to be investigated, but we can't really help you. If you are fairly certain that is happening, you can send your scene as a bug report to unity.
     
  8. CPXTom

    CPXTom

    Joined:
    Apr 24, 2010
    Posts:
    113
    Using the profiler will incur a small memory cost, which is probably why it's crashing for you (you're too close to the memory limit). If your textures aren't referenced, unity will not build them into your binary, unless they're in a "Resources" folder. Even then, they wouldn't be loaded into memory unless you explicitly loaded them yourself using Resources.Load or you loaded some object that referenced the texture.
     
  9. thtcaribbeanguy

    thtcaribbeanguy

    Joined:
    Jul 4, 2014
    Posts:
    32
    same problem game crashes at start
    dropped the resolution and max size to low as possible
    use to work fine before at high resolution ( but bad performance )
    but all of a sudden wont load even if i dont load anything that causes animation on the screen
    it will eat memory and die