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

Poll about Unity applications memory warnings/crashes on iOS7.

Discussion in 'iOS and tvOS' started by tatoforever, Nov 26, 2013.

?

State of your application in iOS7.

  1. My application is having memory crashes on iOS7 (never crashed on iOS6/5).

    84.2%
  2. My application gives a bunch of memory warnings on iOS7 (never crashed on iOS6/5).

    8.8%
  3. My application runs fine (no memory crashes no memory wanings) on iOS7/6/5.

    7.0%
  1. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,337
    This thread will serve to collect people's applications memory issues and crashes with iOS7 so Unity can put some attention to it and perhaps work together to fix this problematic issue that is plaging lot of people. :rolleyes:
    Whether you are having memory warnings or crashes with iOS7 but never seen on iOS6 (with the same exact application) you should post your application memory stats here (and of course vote).

    Here is a simple way to debug your application memory use on your device:
    - Using the Apple's Instruments application, chose iOS - Memory. If you don't know where Instruments is here is: Finder, Applications, Xcode (right click on it and select "Show Package Contents", Contents, Applications, Instruments (put it on your dock, you'll need it very often).
    - Once you got Instruments open, click on the "All Processes" dropdown list and select "Chose Target" -> "Your application Name".
    - Click the "Record" button (the small rounded red dot on the top left), your application will open and you'll see the memory stats in real-time.

    Feel free to posts any information about your memory issues on iOS6 vs iOS7 here. ;)
     
    Last edited: Nov 26, 2013
  2. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,337
    Already mention by a bunch of folks over the internet, iOS7 now kills apps that uses only one thread and hell of memory.
    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.

    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
    Short version, if your application isn't multithreaded then you have less amount of RAM on iOS7 (thus that's why it gets killed earlier).
    Although, I’m not quite sure about how multithreading works in Unity iOS, but could be related to the new restrictions in iOS7.
     
  3. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,337
    Here are my stats:
    We use in average (per scene) about 225-250MBs. When loading a new scene, memory goes beyond 300MBs and Application gets killed by OS. Btw, scenes aren't loaded additively, nothing is kept on memory (except a tiny small database less than few 50KBs that holds few objects states).
     
  4. hellobard

    hellobard

    Joined:
    Sep 26, 2012
    Posts:
    139
    i'm having the same issue, 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.
     
  5. Selosoft

    Selosoft

    Joined:
    Jun 22, 2012
    Posts:
    69
    I'm having the same issue on iPhone 4S. I'm clearing off the phone and resetting the device. If there is a change I'll post based on that. On an iPhone 5 : no issue at all. Game runs great. 30% memory usage, always above 30fps and cpu usage below 30%. iPhone 4s on the other hand has nearly 100% cpu usage, 50-60% memory usage and runs between 20-30fps. Game is using 250-300mb of memory. I've already compressed everything except the UI, but that may be necessary at this point. Lightmapping might need to be avoided on the 4S as well. I'm digging into this and if I come across some good solutions I'll post.
     
  6. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,337
    Have you reported that?
    I got some emails from Unity staff asking me for projects, they want to give it a look, so if you can (at least) upload your project (or any scene of it) that get crashed due to memory in iOS7, I'll be happy to give them the case # directly. :)
    Cheers,
     
  7. Tiny-Tree

    Tiny-Tree

    Joined:
    Dec 26, 2012
    Posts:
    1,314
    My app run from 110mb (menu) to 155~190mb to game scenes, i load a new scenes every 15 minutes.
    the game run on IOS 7 sometime it dont have memory warning:
    -if i just restarted the ipad mini
    -if i dont use social and gamecenter or iap native feature.

    some scenes at 190mb are stable, some other at 160mb have a memory warning every second.
    I dont know if my stats help.
     
  8. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,337
    Do you have memory crashes?
     
    quaking likes this.
  9. Tiny-Tree

    Tiny-Tree

    Joined:
    Dec 26, 2012
    Posts:
    1,314
    "app closed due to memory pressure" from xcode when its happen
     
  10. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,337
    That's a crash yeah.
    Next step, is to make a bug report with your xcode project. Please provide it here. :)
     
  11. Tiny-Tree

    Tiny-Tree

    Joined:
    Dec 26, 2012
    Posts:
    1,314
    hm how to bug report?:D i will post that tomorrow morning. ( china~time to sleep)
     
  12. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,337
    If you have dropbox, FTP or somewhere to upload your Xcode project, that should be enough. Then go to Unity top Menu - Help - Report a bug. And give all details about your xcode project (where you uploaded it, if there's any login to get the files, how to trigger the crash once the game is build and running, etc). Don't forget to give a very good descriptive name, otherwise your bug could picked up a non-priority bug. Name it something like: "Game crashes on iOS7 due to memory pressure". Also you must provide a valid email address (they will send you a case number there, and will future communicate with you if they need more information on your case).
    Once you send the bug report, please post the case number here and I'll pass it out to Unity developers on the beta list. :)
     
  13. Selosoft

    Selosoft

    Joined:
    Jun 22, 2012
    Posts:
    69
    Well I can confirm that you will receive memory warnings only once your memory usage exceeds 225mb. Once you go over 250mb, it's only a matter of time until the app crashes. That's the max you can go apparently. You will receive a ton of warnings once you breach 225 though. This is only for the iPhone 4s running the latest version of iOS 7.

    I think it's going to take some more optimizing to meet this criteria (more audio compression and utilization of Resources.
     
  14. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,337
    I've seen some people reporting low memory footprint applications such as Maps crashing on the iOS7. But the fact that past 250MBs of use will lead to crash is on purpose. Apple doesn't want singled-threaded application to eat much ram (yeah I know it sucks and will remain like this from now then). What people must do (including Unity itself) is to make their applications multi-threaded, so they can use all available free ram on iOS7. But it's something it won't come any time sooner. Unity will remain single-threaded (at least on mobile) for a very long time cause that's how the engine is currently designed (correct me if I'm wrong).
    If someone knows how to bypass that memory limitation (forced by iOS7 for single-threaded applications), it'll be good to know. :rolleyes:
     
    Last edited: Dec 21, 2013
  15. jonathanhart

    jonathanhart

    Joined:
    Jun 12, 2013
    Posts:
    7
    Hi guys,

    Just thought you would like to know that AIR is facing a similar problem:

    http://bugbase.adobe.com/index.cfm?event=bug&id=3649713

    If it's the same issue, inspecting the Console Log you should see a string of memory warnings in rapid fire succession accompanied by weird problems from wirelessproxd:


    Jan 3 13:01:55 ED-iPadMini Oz[9620] <Warning>: Received memory warning.
    Jan 3 13:01:55 ED-iPadMini Oz[9620] <Warning>: Application received a memory warning from the system.
    Jan 3 13:01:55 ED-iPadMini lockdownd[51] <Notice>: xpc __securityd_create_connection_block_invoke got event: Connection interrupted
    Jan 3 13:01:55 ED-iPadMini com.apple.launchd[1] (com.apple.securityd[10590]) <Notice>: (com.apple.securityd) Idle-exit job was jettisoned. Will bypass throttle interval for next on-demand launch.
    Jan 3 13:01:55 ED-iPadMini com.apple.launchd[1] (com.apple.securityd[10590]) <Error>: (com.apple.securityd) assertion failed: 11B511: launchd + 35765 [C04CBC4A-F11B-3F42-8619-D512726C6533]: 0x9
    Jan 3 13:01:55 ED-iPadMini wirelessproxd[10588] <Warning>: Started wirelessproxd
    Jan 3 13:01:55 ED-iPadMini locationd[5828] <Warning>: WiProx Power state bluetooth on
    Jan 3 13:01:55 ED-iPadMini locationd[5828] <Warning>: XPC Client error: Connection interrupted
    Jan 3 13:01:55 ED-iPadMini locationd[5828] <Warning>: WirelessProximity connection was interrupted.
    Jan 3 13:01:55 ED-iPadMini locationd[5828] <Warning>: XPC Client error: Connection interrupted
    Jan 3 13:01:55 ED-iPadMini locationd[5828] <Warning>: XPC Client error: Connection interrupted
    Jan 3 13:01:55 ED-iPadMini com.apple.launchd[1] (com.apple.wirelessproxd[10588]) <Notice>: (com.apple.wirelessproxd) Idle-exit job was jettisoned. Will bypass throttle interval for next on-demand launch.
    Jan 3 13:01:55 ED-iPadMini com.apple.launchd[1] (com.apple.wirelessproxd[10588]) <Error>: (com.apple.wirelessproxd) assertion failed: 11B511: launchd + 35765 [C04CBC4A-F11B-3F42-8619-D512726C6533]: 0x9
    Jan 3 13:01:55 ED-iPadMini mc_mobile_tunnel[10591] <Notice>: (Note ) MC: mc_mobile_tunnel starting.
    Jan 3 13:01:55 ED-iPadMini lockdownd[51] <Notice>: xpc __securityd_create_connection_block_invoke got event: Connection interrupted
    Jan 3 13:01:55 ED-iPadMini com.apple.launchd[1] (com.apple.securityd[10593]) <Notice>: (com.apple.securityd) Idle-exit job was jettisoned. Will bypass throttle interval for next on-demand launch.
    Jan 3 13:01:55 ED-iPadMini com.apple.launchd[1] (com.apple.securityd[10593]) <Error>: (com.apple.securityd) assertion failed: 11B511: launchd + 35765 [C04CBC4A-F11B-3F42-8619-D512726C6533]: 0x9
    Jan 3 13:01:55 ED-iPadMini Oz[9620] <Warning>: Received memory warning.
    Jan 3 13:01:55 ED-iPadMini Oz[9620] <Warning>: Application received a memory warning from the system.
    Jan 3 13:01:55 ED-iPadMini lockdownd[51] <Notice>: xpc __securityd_create_connection_block_invoke got event: Connection interrupted
    Jan 3 13:01:55 ED-iPadMini com.apple.launchd[1] (com.apple.securityd[10595]) <Notice>: (com.apple.securityd) Idle-exit job was jettisoned. Will bypass throttle interval for next on-demand launch.
    Jan 3 13:01:55 ED-iPadMini com.apple.launchd[1] (com.apple.securityd[10595]) <Error>: (com.apple.securityd) assertion failed: 11B511: launchd + 35765 [C04CBC4A-F11B-3F42-8619-D512726C6533]: 0x9
    Jan 3 13:01:55 ED-iPadMini Oz[9620] <Warning>: Received memory warning.
    Jan 3 13:01:55 ED-iPadMini Oz[9620] <Warning>: Application received a memory warning from the system.
    Jan 3 13:01:56 ED-iPadMini wirelessproxd[10592] <Warning>: wirelessproxd logging began
    Jan 3 13:01:56 ED-iPadMini wirelessproxd[10592] <Warning>: Started wirelessproxd
    Jan 3 13:01:56 ED-iPadMini locationd[5828] <Warning>: WiProx Power state bluetooth on
    Jan 3 13:01:56 ED-iPadMini locationd[5828] <Warning>: XPC Client error: Connection interrupted
    Jan 3 13:01:56 ED-iPadMini com.apple.launchd[1] (com.apple.wirelessproxd[10592]) <Notice>: (com.apple.wirelessproxd) Idle-exit job was jettisoned. Will bypass throttle interval for next on-demand launch.
    Jan 3 13:01:56 ED-iPadMini com.apple.launchd[1] (com.apple.wirelessproxd[10592]) <Error>: (com.apple.wirelessproxd) assertion failed: 11B511: launchd + 35765 [C04CBC4A-F11B-3F42-8619-D512726C6533]: 0x9
    Jan 3 13:01:56 ED-iPadMini locationd[5828] <Warning>: WirelessProximity connection was interrupted.
    Jan 3 13:01:56 ED-iPadMini locationd[5828] <Warning>: XPC Client error: Connection interrupted
    Jan 3 13:01:56 ED-iPadMini locationd[5828] <Warning>: XPC Client error: Connection interrupted
    Jan 3 13:01:57 ED-iPadMini wirelessproxd[10596] <Warning>: wirelessproxd logging began
    Jan 3 13:01:57 ED-iPadMini wirelessproxd[10596] <Warning>: Started wirelessproxd
    Jan 3 13:01:57 ED-iPadMini locationd[5828] <Warning>: WiProx Power state bluetooth on
    Jan 3 13:01:57 ED-iPadMini com.apple.launchd[1] (com.apple.wirelessproxd[10596]) <Notice>: (com.apple.wirelessproxd) Idle-exit job was jettisoned. Will bypass throttle interval for next on-demand launch.
    Jan 3 13:01:57 ED-iPadMini com.apple.launchd[1] (com.apple.wirelessproxd[10596]) <Error>: (com.apple.wirelessproxd) assertion failed: 11B511: launchd + 35765 [C04CBC4A-F11B-3F42-8619-D512726C6533]: 0x9
    Jan 3 13:01:57 ED-iPadMini locationd[5828] <Warning>: XPC Client error: Connection interrupted
    Jan 3 13:01:57 ED-iPadMini locationd[5828] <Warning>: WirelessProximity connection was interrupted.
    Jan 3 13:01:57 ED-iPadMini locationd[5828] <Warning>: XPC Client error: Connection interrupted
    Jan 3 13:01:57 ED-iPadMini locationd[5828] <Warning>: XPC Client error: Connection interrupted
    Jan 3 13:01:58 ED-iPadMini wirelessproxd[10597] <Warning>: wirelessproxd logging began
    Jan 3 13:01:58 ED-iPadMini wirelessproxd[10597] <Warning>: Started wirelessproxd
    Jan 3 13:01:58 ED-iPadMini locationd[5828] <Warning>: WiProx Power state bluetooth on
    Jan 3 13:01:58 ED-iPadMini locationd[5828] <Warning>: XPC Client error: Connection interrupted
    Jan 3 13:01:58 ED-iPadMini locationd[5828] <Warning>: WirelessProximity connection was interrupted.
    Jan 3 13:01:58 ED-iPadMini locationd[5828] <Warning>: XPC Client error: Connection interrupted
    Jan 3 13:01:58 ED-iPadMini locationd[5828] <Warning>: XPC Client error: Connection interrupted
    Jan 3 13:01:58 ED-iPadMini Oz[9620] <Warning>: Received memory warning.

    When the problem is really bad, we're seeing 3+ memory warnings per second.

    Corona has appeared to surface this issue as well:

    http://forums.coronalabs.com/topic/40338-ios7-memory-warning/
     
  16. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,337
    Something is telling me that Apple have f*ck*d up things out on iOS (once again). :rolleyes:
     
  17. intoscienceDing

    intoscienceDing

    Joined:
    Nov 29, 2012
    Posts:
    10
  18. fred_gds

    fred_gds

    Joined:
    Sep 20, 2012
    Posts:
    184
    Actually I am having the same problem. my app was running fine on iPhone 4S with iOS 6 but on iOS 7 it keeps crashing. So actually it does run for up to 200 mb which I am loading in the first instance but then when I load the rest of my scene with application.load additiv it crashes so it's at about 210 mb when it crashes.

    I would love to file bug reports but I can't as my project is over 10 gb
     
  19. Graham-Dunnett

    Graham-Dunnett

    Unity Technologies

    Joined:
    Jun 2, 2009
    Posts:
    4,287
    Is it crashing or getting killed by the OS? Do you get didReceiveMemoryWarning messages? Your app might be crashing, but I suspect it's getting killed.
     
  20. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,337
    It's getting killed yeah.
     
  21. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,337
    We got an iOS project that is over 60GBs large and we've managed to stripe it out to `1GB and made a pretty nice report for Unity folks to try out this issue.
    Something that you could try (if you have separated folders for your assets). Select two scenes from which your game gets killed when doing your Load calls, right click on them -> Select Dependencies, once all dependencies are selected, right click on any of that list of assets -> Export package, a new window will show-up (uncheck "Select Dependencies"), once your scene package is exported create a new project, import the package, copy the ProjectSettings content from your big project into the new project and repeat the package-export process for your scripts/shaders folders.
    This actually works if you keep your project well organized (Eg: All yours are scripts are organized in folders, same for your shaders, Editor Tools, etc). PS: The heavier assets (Sounds/Videos, Textures and meshes) where already exported so scripts and shaders etc won't eat that much space.
     
    Last edited: Jan 15, 2014
  22. fred_gds

    fred_gds

    Joined:
    Sep 20, 2012
    Posts:
    184
    I guess it gets killed. I keep receiving memory warnings. and sometimes I even get the message in xcode that it closed because of memory pressure.

    So a strange thing happened when I change the shaders of my trees from "soft occlusion leaves" to a basic particle shader, as I gained some performance so that my app now runs a little bit longer but it still crashes/gets closed after a couple of minutes due to memory usage.
     
  23. fred_gds

    fred_gds

    Joined:
    Sep 20, 2012
    Posts:
    184
    Yeah I know I could do that but I don't really have time to do that.


    Another strange thing I noticed is that I am using 164 mb of Ram on the iPhone 5S and 220 mb on the iPhone 4S so I don't quiet understand why. I already stripped of a couple of assets when loading on the 4S and I also run the garbage collector a couple of times. It would be great if somebody could explain this too me. I mean that explains why I have those performance problems on the 4S but I am missing the solution.

    $Bildschirmfoto 2014-01-16 um 00.32.53.png

    As a solution I was wondering whether it would make sense to play with the memory pressure System.GC.RemoveMemoryPressure or System.GC.AddMemoryPressure. But I had no time trying that out yet
     
    Last edited: Jan 15, 2014
  24. Daniel.sb

    Daniel.sb

    Joined:
    Feb 7, 2014
    Posts:
    1
    Hi there,

    I can confirm this problem. I'm having the same issues with a 2d game with low memory usage. It runs perfectly on iOS 6, but get random crashes on iOS 7. I'm running Unity 4.3.1 and Xcode 5.0.1 and the project is around 81mb (compiled and uploaded to the App Store)

    Is there any fix, workaround or update already?
     
  25. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    Issues still present in 7,1 and Xcode 5.1?
     
  26. JFo

    JFo

    Joined:
    Dec 9, 2007
    Posts:
    217
    Yes. We have iPad2 updated to iOS 7.1 and with latest Unity/XCode we get crashes after some time. The memory footprint stays in 105M so no leaks, but
    still after 2-3 memory warnings app crashes. Any new ideas?
     
  27. Mantas-Puida

    Mantas-Puida

    Unity Technologies

    Joined:
    Nov 13, 2008
    Posts:
    1,864
    Do you measure memory usage with Unity Remote Profiler or Xcode? If the later is showing 105MB and still crashing, please submit your project as bug report.
     
  28. JFo

    JFo

    Joined:
    Dec 9, 2007
    Posts:
    217
    Yes. It's from XCode. Sorry, cannot send this project (hopefully someone can) but this is what we found out:

    We managed to FIX this, so no more crashes.

    In UnityAppController.mm we modified this:
    Code (csharp):
    1.  
    2. - (void)applicationDidReceiveMemoryWarning:(UIApplication*)application
    3. {
    4.     printf_console("WARNING -> applicationDidReceiveMemoryWarning()\n");
    5.     UnitySendMessage("AppControllerGO", "iOSMemoryWarningReceiver", "");
    6. }
    7.  
    In Unity side, the message receiver (attached to GameObject named AppControllerGO) was like this:

    Code (csharp):
    1.  
    2. public void iOSMemoryWarningReceiver (string msg)
    3. {
    4.     GC.Collect();
    5.     Resources.UnloadUnusedAssets();
    6. }
    7.  
    As seen from this XCode mem profiler screenshot when run in iPhone 4S, mem stays near 100MB. Those small falls shows what happens when the memory warning hits and the message receiver code kicks in and Unity manages to free some mem...

    $iosMem.PNG

    You can see that the memory consumption stays nicely in the same - and it was run over 30min without crash(!).
    There is no logical reason for those warnings. If googling this topic, it seems to be quite common problem,
    so it seems like an Apple bug in iOS7 (not a big surprise).

    Hope this helps...
     
  29. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,337
    Something is telling me iOS is simply killing Apps if they don't free unused memory periodically. I've also seen lot of crashes with 100-150MBs usage on 512MB devices (mesured with Apple's Instruments tools).
     
    liortal likes this.
  30. latas

    latas

    Joined:
    Oct 9, 2013
    Posts:
    149
    Hi everyone we're experiencing this issue and worst part is that it looks unity loads the next scene before remove the old one. So in this way you need more memory for the loading step than the one you'll need in the next scene. It is true that as soon as the scene is loaded unity releases the memory corresponding to the old scene, but what happens meanwhile. I mean it's really hard not bypass 250Mb at least for a while. Testing with ipad mini we're not able to make it works.
     
  31. Mantas-Puida

    Mantas-Puida

    Unity Technologies

    Joined:
    Nov 13, 2008
    Posts:
    1,864
    Small intermediate scene works fine most of the time.
     
  32. JFo

    JFo

    Joined:
    Dec 9, 2007
    Posts:
    217
    This sounds like a hack. Is there any plans to change the scene loading behavior in the future?
     
  33. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,337
    Unfortunately (like most of people here) I had to implement this hack as my game was also crashing even on 1GBs+ devices! :|
    The fact that Unity doesn't free any memory between scene loadings is insane yeah.
     
  34. Mantas-Puida

    Mantas-Puida

    Unity Technologies

    Joined:
    Nov 13, 2008
    Posts:
    1,864
    iOS is quite greedy in RAM consumption department, it leaves ~600-700 MB for your app depending on iOS/device version. Unity's two subsequent scene loading strategy is optimized for speed rather than peak memory usage, adding extra loading scene is just picking different strategy. If your main scene is quite far away from numbers I mentioned above in terms of memory usage, I would happy to look at your project, why peak mem usage is causing a crash. Please submit it as bug report.
    Thanks!
     
  35. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,337
    I can't submit a 25GB finalized project but I'll see if I can strip down our game with 2-3 scenes in a repro-case. Each of our game scenes uses about 200-250MBs RAM which leads to frequent crashes on 512MBs devices at medium quality. The same game in high quality mode crashes on 1GB devices too.

    Speaking of subsequent scene loading, can't you just guys look at what asset's being referenced between the current scene and the loading scene? And thus destroy the assets not being referenced in the new scene while keeping in memory referenced assets by the new scene BUT don't load new assets until unreferenced assets are destroyed!?
    Dunno if you got what I mean? :rolleyes:
     
    Last edited: Mar 25, 2014