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

game crashes on iPad 2 with iOS7 with Unity 4.2.x, did run fine on previous versions

Discussion in 'iOS and tvOS' started by stationx, Sep 23, 2013.

  1. stationx

    stationx

    Joined:
    Jul 9, 2012
    Posts:
    251
    Hello,
    I am experiencing another problem. When I run the game through xCode (latest version) on iPad 2 with iOS7, the game crashes. CPU is around 50% / 60%, memory is around 150 / 170 mb. I am receiving this memory warning from xCode:
    game exited unexpectedly.
    Terminated due to Memory Pressure.

    What does this mean?


    My previous setting was: iPad 2, iOS 6.x.x. Unity 4.2.0. The game did run fine! No crashes, and no warnings! So I don't know if this is Unity related, my game or iOS 7 with the new version of xCode.

    btw: here is a part of the xCode console:

    Unloading 1 unused Assets to reduce memory usage. Loaded Objects now: 427.
    Total: 2.134500 ms (FindLiveObjects: 0.083375 ms CreateObjectMapping: 0.126208 ms MarkObjects: 1.638125 ms DeleteObjects: 0.047000 ms)

    UnloadTime: 1.595833 ms
    Unloading 1 Unused Serialized files (Serialized files now loaded: 0 / Dirty serialized files: 0)

    Unloading 1 unused Assets to reduce memory usage. Loaded Objects now: 427.
    Total: 2.362041 ms (FindLiveObjects: 0.085875 ms CreateObjectMapping: 0.096125 ms MarkObjects: 1.389458 ms DeleteObjects: 0.041375 ms)

    UnloadTime: 1.643458 ms
    Unloading 1 Unused Serialized files (Serialized files now loaded: 0 / Dirty serialized files: 0)

    Unloading 1 unused Assets to reduce memory usage. Loaded Objects now: 427.
    Total: 1.708000 ms (FindLiveObjects: 0.097083 ms CreateObjectMapping: 0.096000 ms MarkObjects: 1.311625 ms DeleteObjects: 0.043375 ms)

    2013-09-23 09:56:57.355 ddla074[1413:60b] Received memory warning.
    WARNING -> applicationDidReceiveMemoryWarning()
     
  2. Graham-Dunnett

    Graham-Dunnett

    Unity Technologies

    Joined:
    Jun 2, 2009
    Posts:
    4,287
    iOS is running low on memory, and has asked all applications to free up memory that they are not using. Once your app has received this message, if no memory is freed up (by your game or any other app) iOS will randomly kill apps. So, think of the message as saying "you are going to get killed". Possibly iOS7 is using fractionally more memory than iOS6 did.
     
  3. Wonderwood-Games

    Wonderwood-Games

    Joined:
    Jan 21, 2013
    Posts:
    14
    We have the same problem here...

    Our game consume 188MB of RAM in the heaviest frames and on iOS 6 everything were great on iPhone 4S, but now we constantly receive memory warnings and game closes after some random time.
     
  4. ShinyTaco

    ShinyTaco

    Joined:
    Sep 4, 2012
    Posts:
    70
    Just another warning. I had an App rejected for crashing on iPad 3rd Gen running iOS 7. Unity 4.2.1f4.
     
  5. stationx

    stationx

    Joined:
    Jul 9, 2012
    Posts:
    251
    damn, seems like this can cause quite a bit of hassle to get the game back on the perfect state as it was on iOS 6.
    I managed to reduce the crashes by compressing some textures. So memory usage has gone from 170 to +- 70mb.
    Although, some textures now looks a bit blurry...:-s But I am not sure if the crashes are over.
     
  6. tho.mas

    tho.mas

    Joined:
    Apr 3, 2013
    Posts:
    6
    We have the same problem. On iOS 6 everything worked great without any memory warning. On iOS 7 the ipad mini and ipad 2 throw MANY memory warnings.

    I made a backup of my ipad mini, reseted all settings and tested it again: Everything works without warnings.
    So I restored my backup and tested again: It still works...

    It seems like this problem only appears on some devices. On other ipad 2s and ipad minis no problems were found (all with iOS7). The ipad 4 seems to have no problem, so it is memory related.
     
    Last edited: Sep 24, 2013
  7. rrabassa

    rrabassa

    Joined:
    Jul 17, 2013
    Posts:
    170
    Same problem here - just got rejected from Apple app store....
    -r
     
  8. zezba9000

    zezba9000

    Joined:
    Sep 28, 2010
    Posts:
    983
    I was kind of wondering if iOS7 would suck up more ram.
    I'm sure with future iOS7 versions they may fix some of the ram issues I would hope.
     
  9. rrabassa

    rrabassa

    Joined:
    Jul 17, 2013
    Posts:
    170
    So what's the fix? I'm not an XCoder and I use UNITY to "shelter" me from having to figure that stuff out...
    Specifically my app freezes on the UNITY splash screen now. This worked perfectly in the previous OS.


    -r
     
    Last edited: Sep 25, 2013
  10. tho.mas

    tho.mas

    Joined:
    Apr 3, 2013
    Posts:
    6
    There is no fix right no. It seems to be an OS related problem.
    I found some posts in the Apple Developer Forum about that problem, so native Apps are affected, too. Some other Engines (e.G. the Sparrow Engine) have Problems, too.
    As I said befor, backup your iOS device, reset only the settings, restore the backup and it (maybe) will work again. I was told that some people had to do this when upgrading from iOS 4 to 5 to prevent some apps from crashing.
     
  11. stationx

    stationx

    Joined:
    Jul 9, 2012
    Posts:
    251
    guess we all have to wait until an iOS 7.1 release is coming. But it is going to be painful when Apple start rejecting apps because they crash on their own iOS 7 and there is not much we can do to improve the apps. Although, reducing memory in my project seems to reduce the crashes a bit.
     
  12. tho.mas

    tho.mas

    Joined:
    Apr 3, 2013
    Posts:
    6
    I just updated to iOS 7.0.2 and it seems to make things better. There are memory warnings at the start of the game, but after a while of loading stuff in the background the memory warnings stop.
    Do you observe similar behavior?
     
  13. Mantas-Puida

    Mantas-Puida

    Unity Technologies

    Joined:
    Nov 13, 2008
    Posts:
    1,864
    We were unable to reproduce memory issues reported on this thread. We tried various iOS devices having 512MB of RAM and running iOS7, though on all of them our sample app survived up to 300 MB heap allocations. Actually iOS 7 was showing slightly better result than iOS 6.x.

    If somebody submits repro case as bug report we would be happy to look at it.
    Thanks
     
  14. stefstivala

    stefstivala

    Joined:
    Oct 27, 2012
    Posts:
    8
    same problem exactly here. even with 7.0.2, crashes on loading. ran fine on iOS6.
    iPad 2 mostly, iPad Mini just a bit less.

    even had to flip the game to free as i'm getting bad reviews support email galore now :(
     
  15. tho.mas

    tho.mas

    Joined:
    Apr 3, 2013
    Posts:
    6
    Our repro is around 11 GB big, so it's not possible to upload it. Maybe someone else has a smaller project?
     
    Last edited: Oct 2, 2013
  16. stationx

    stationx

    Joined:
    Jul 9, 2012
    Posts:
    251
    Mine is also very big. Beside: a small workaround that may help here.
    To reduce crashes: use Unity 4.2.0 and xCode 4.x.x. Build (not build run) open the project in xCode 4 and run the game.
    I recently had a stress test two days long for my game. I did not have any crashes using this workaround on an iPad2 with iOS 7.
     
  17. AlexAlex

    AlexAlex

    Joined:
    Sep 26, 2013
    Posts:
    3
    I have same issue. On some iPad mini devices game runes fine on iOS 7 and on some iPad mini devices it crushes. Can understand the logic in this crushes because on all our test iPad mini devices game works fine. And our clients report crushes on iPad mini devices.
     
  18. renderbox

    renderbox

    Joined:
    Jul 28, 2011
    Posts:
    12
    We're having the issue too (client noticed it on iPad 2, we can repro on iPad mini). What I was wondering is if it's tied to the new Memory Compression in iOS7. Did you test your device with lots of apps running, eating up memory?

    The other possible idea that came to mind and is worth testing is installing the app before upgrading to iOS 7, upgrade and then test. From reading the thread there could be something that is set when the app is installed that is not properly reset when the OS upgrade happens?

    We'll be investigating this further to see what other clues are worth looking into.
     
  19. SpiriTx

    SpiriTx

    Graphics QA Unity Technologies

    Joined:
    Apr 12, 2012
    Posts:
    252
    Hi,

    We've investigated this issue, but for now it just looks like iOS7 killing apps earlier.

    Any repro projects with apps being killed at 150-200mb (with no other backgrounds apps running) would be very welcome.
     
  20. Hemant Sharma

    Hemant Sharma

    Joined:
    May 28, 2013
    Posts:
    4
    Hii everyone,

    I was facing the same problem for my game when I was running in iOS 7 , iPad mini and Unity 4.1.5. The only solution I have got till now is try to restart your device, this will free all the memory leaks of your device and let your game running normally without any memory pressure.
     
  21. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,337
    I just now notice something odd that requires explanation from Unity developers. :rolleyes:

    A typical lightmapped scene I have in Unity Desktop takes about 18MBs (only the lightmaps textures) but on Unity iOS it takes 55MBs compressed!
    Also i got some scenes that uses about 26MBs in lightmaps (compressed) on windows but on Unity iOS they take more than 100MBs
    What’s going on with lightmaps compression in Unity iOS? Why it takes more than twice the amount of ram? :/
    Can some Unity devellopers share some thoughts on it? :rolleyes:

    I've also notice that Unity doesn't seems to free memory while loading new scenes (only once the scene is loaded)... But then it's too late my App have already crashed...

    PS: This issue plus the fact that iOS7 now uses more memory (or simply kills application if it takes X% of available system memory) = Games having more frequent crashes due to memory pressure! :/
     
  22. Mantas-Puida

    Mantas-Puida

    Unity Technologies

    Joined:
    Nov 13, 2008
    Posts:
    1,864
    Please submit a bug report for high memory usage for lightmaps.

    P.S. when changing scenes you might consider small transitional scene to avoid two big scenes loading one after another.
     
  23. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,337
    Hi Mantas,
    Thanks for your quick reply! I'm gattering a new scene and will post the case # here once it's uploaded to our FTP.

    As for the small transitional scene will this force all our already loaded assets to be loaded again? We have tons of shared assets between scenes, if we introduce an emtpy scene (aka a loading scene) this will require a complete reload of all our assets every time we load a new scene right?
    Cheers, :rolleyes:
     
  24. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,337
    Hey Mantas,
    I've reported the lightmaps bug (a small test scene is attached) here is: 577614
    In short, 21 lightmaps (1024*1024) in Unity Standalone (Mac and Windows) takes 55MBs of Ram. In Unity iOS it takes 126MBs of Ram!!! :(
    Take a look at the project I've attached in the bug case.
     
  25. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,337
    The issue appears to be only when Unity tries to compress lightmaps textures ".EXR" file format but only on Unity iOS. It compress the texture fine on Mac/PC Standalone but takes about 5x-6x on Unity iOS! :/
     
  26. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    Has the issue been resolved with Unity 4.3?
     
  27. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,337
    No, it was rather shipped with Unity 4.3. I'm doing some new tests in v4.2 to see if the issue is also there.
     
  28. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,337
    I also got an answer from QA staff telling me that the lightmap editor doesn't recognize the PVRT texture real-size so it uncompress it and show you that. Really? :\ Select the lightmap texture (Texture Import) and you'll see the actual size of the texture.


    Anyway, iOS7 now kills apps that uses only one thread and hell of memory.
    You can find more information here:
    http://stackoverflow.com/questions/18866847/ios-7-memory-issues
    http://stackoverflow.com/questions/18759401/google-map-crashes-in-ios7
    [FONT="] Something is telling me that Unity apps gets killed earlier cause they only uses one thread and this is how iOS7 works now. :/
    Although, I’m not quite sure about how multithreading works in Unity iOS, but could be related to the new restrictions in iOS7.


    [/FONT]


    More on the same subject.

    In iOS 7, apple introduced more restriction on memory allocation for single instance. If the single thread uses more memory it should crash. This is not only related to native application but also related to hybrid app.

    What do folks at Unity recommends?
     
  29. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    Very interesting post and excellent research, now we wait for a solution or suggestion.
     
  30. Colin Darkwind

    Colin Darkwind

    Joined:
    Apr 18, 2013
    Posts:
    1
    Just wanted to mention that we are facing the same problem that many people are describing here.

    Unity 4.2.2
    Crashing on iOS 7 devices (iPad 2, iPad Mini Gen 1, iPhone 4) that were not present on iOS 6 due to memory pressure
    Seems to get terminated around 250 MB of memory used. The game has large scenes with several animation clips and textures and game objects

    To support what someone else mentioned, even if we get our scenes down to about 220 MB of memory each, do nearly empty scene loads between scenes, Resources.UnloadUnusedAssets and even System.GC.Collect(), we seem to get an ever increasing UsedHeapSize. This over time will push our scenes that are at 220 - 230 up to 250-260 across scenes and eventually cause a crash. The problem does not seem to be so much of an issue when loading the same scene over and over .. just between scenes. As has been mentioned in several other posts, my only guess at this time is that it is due to heap fragmentation.

    Its difficult for us to think about doing more texture crunch as we want the game to be high definition for newer generation devices ... and while we can try to do more dynamic resource loading based on platform, the game is already released and there isn't really much time to change much of the system architecture.

    I will be following this post and wait anxiously to see if anyone has found some miraculous solution.
     
  31. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,337
  32. hellobard

    hellobard

    Joined:
    Sep 26, 2012
    Posts:
    139
    i'm having the same issue with Unity 4.3.1 and iOS 7.0.4, but only on iPad 4 and not iPhone 5. Textures are higher resolutions, so that's probably why that happens.

    Memory springs up past 300 mb's (with lots free) and the app gets terminated... It seems like this is an issue between Unity and Apple, so hopefully it will be resolved soon!
     
  33. intoscienceDing

    intoscienceDing

    Joined:
    Nov 29, 2012
    Posts:
    10
    Hi.

    We have the same problem as well.

    In our application we have a lots of assetbundle load-in and load-out, it runs fine at the start, but however after a while we receive memory warning from IOS, even the memory usage in Instruments is below 200MB .

    The "usedheapsize" is stable when we swap in and out assetbundles in the Profile, the "MonoHeapSize" in the Profile keep increasing from the start, but it reacher its limits after a while, then from then it keeps there.

    Is it possible to reduced "MonoHeapSize", as for the most the time "MonoUsedSize" is much smaller than the "MonoHeapSize".

    Also one thing need mention is that if we restart the device, it takes longer for us to receive system memory warnings.

    Device: iPad 2
    Environment: Unity 4.2.2 + iOS 7.0.4
     
  34. Aman1234

    Aman1234

    Joined:
    Apr 19, 2016
    Posts:
    16
    simply switch on or off your device.that will clear memory leaks.this works for me ;)